<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>Locale</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade><blockquote>
<center>
<h2><a name = "tag_005">&nbsp;</a>Locale</h2>
</center>
<xref type="1" name="locale"></xref>
<h3><a name = "tag_005_001">&nbsp;</a>General</h3>
<xref type="2" name="locgen"></xref>
A
<i>locale</i>
is the definition of the subset of a user's environment that depends
on language and cultural conventions.
It is made up from one or more categories.
Each category is identified by its name and controls specific aspects
of the behaviour of components of the system.
Category names correspond to the following environment variable names:
<dl compact>

<dt><i>LC_CTYPE</i><dd>Character classification and case conversion.

<dt><i>LC_COLLATE</i><dd>Collation order.

<dt><i>LC_TIME</i><dd>Date and time formats.

<dt><i>LC_NUMERIC</i><dd>Numeric, non-monetary formatting.

<dt><i>LC_MONETARY</i><dd>Monetary formatting.

<dt><i>LC_MESSAGES</i><dd>Formats of informative and diagnostic messages
and interactive responses.

</dl>
<p>
The standard utilities in the <b>XCU</b> specification
base their behaviour
on the current locale, as defined in the
<b>ENVIRONMENT VARIABLES</b>
section for each utility.
The behaviour of some of the C-language
functions defined in the <b>XSH</b> specification will also be modified based on the
current locale, as defined by the last call to
<i><a href="../xsh/setlocale.html">setlocale()</a></i>.
<p>
Locales other than those supplied by the implementation can be
created by the application via the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility,
&nbsp;if it is provided;
see the <b>XCU</b> specification.
This capability is supported on all  systems where the
{POSIX2_LOCALEDEF}
or
{XOPEN_XCU_VERSION}
options are supported; see the <b>XSH</b> specification
<i><a href="../xsh/unistd.h.html">&lt;unistd.h&gt;</a></i>.
Even if
<i><a href="../xcu/localedef.html">localedef</a></i>
is not provided, all implementations conforming to the <b>XSH</b> specification
provide one or more locales that behave as described in this chapter.
&nbsp;The input to the utility is described in
<xref href=locldefn><a href="#tag_005_003">
Locale Definition
</a></xref>.
The value that is used to specify a locale when using environment
variables will be the string specified as the
<i>name</i>
operand to the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility when the locale was created.
The strings
C
and
POSIX
are reserved as identifiers for the POSIX locale (see
<xref href=posixloc><a href="#tag_005_002">
POSIX Locale
</a></xref>).
When the value of a locale environment variable begins with a slash
(/),
it is interpreted as the pathname of the locale definition;
the type of file (regular, directory, and so forth) used to store
the locale definition is implementation-dependent.
If the value
does not begin with a slash,
the mechanism used to locate the locale
is implementation-dependent.
<p>
If different character sets are used by the locale categories, the
results achieved by an application utilising these categories are undefined.
Likewise, if different codesets are used for the data
being processed by interfaces whose behaviour is dependent on the
current locale, or the codeset is different from the codeset
assumed when the locale was created, the result is also undefined.
<p>
Applications can select the desired locale by invoking the
<i><a href="../xsh/setlocale.html">setlocale()</a></i>
function (or equivalent) with the appropriate value.
If the function is invoked with an empty string,
such as:
<code>
<pre>
setlocale(LC_ALL, "");
</code>
</pre>
the value of the
corresponding environment variable is used.
If the environment variable is unset or is set to the empty string,
the implementation sets the appropriate environment as defined in
<xref href=envvar><a href="envvar.html#tag_002">
Environment Variables
</a></xref>.
<h3><a name = "tag_005_002">&nbsp;</a>POSIX Locale</h3>
<xref type="2" name="posixloc"></xref>
All systems provide a
<i>POSIX locale</i>,
also known as the C locale.
The behaviour of standard utilities
and functions in the POSIX locale
is as if the locale was defined via the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility with input data from the POSIX locale tables in
<xref href=locldefn><a href="#tag_005_003">
Locale Definition
</a></xref>.
<p>
The tables in
<xref href=locldefn><a href="#tag_005_003">
Locale Definition
</a></xref>
describe the characteristics and behaviour of the
POSIX locale for data consisting entirely of characters from
the portable character set
and the control character set.
For other characters,
the behaviour is unspecified.
For C-language programs,
the POSIX locale is the default locale when the
<i><a href="../xsh/setlocale.html">setlocale()</a></i>
function is not called.
<p>
The POSIX locale can be specified by assigning to the appropriate
environment variables the values
C
or
POSIX.
<p>
All implementations define a locale as the default
locale, to be invoked when no environment
variables are set, or set to the empty string.
This default locale can be the POSIX locale
or any other, implementation-dependent locale.
Some implementations may provide facilities for
local installation administrators to set the default
locale, customising it for each location.
This specification set does not require such a facility.
<h3><a name = "tag_005_003">&nbsp;</a>Locale Definition</h3>
<xref type="2" name="locldefn"></xref>
Locales can be described with the file format presented in this section.
The file format is that accepted by the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility.
For the purposes of this section, the file is referred to as the
but no locales are affected by this file unless
it is processed by
<i><a href="../xcu/localedef.html">localedef</a></i>
or some similar mechanism.
Any requirements in this section imposed upon the utility
apply to
<i><a href="../xcu/localedef.html">localedef</a></i>
or to any other similar utility used to install locale information
using the locale definition file format described here.
<p>
The locale definition file must contain one or more locale category source
definitions, and must not contain more than one definition for the
same locale category.
If the file contains source definitions for more than one category,
implementation-dependent categories,
if present, must appear after the
categories defined by
<xref href=locgen><a href="#tag_005_001">
General
</a></xref>.
A category source definition must contain either the definition of
a category or a
<b>copy</b>
directive.
For a description of the
<b>copy</b>
directive, see
<i><a href="../xcu/localedef.html">localedef</a></i>.
In the event that some of the information for a locale category,
as specified in this specification, is missing from the locale source
definition, the behaviour of that category, if it is referenced,
is unspecified.
<p>
A category source definition consists of a category header,
a category body and a category trailer.
A category header consists of the character string
naming of the category, beginning with the characters LC_.
The category trailer consists of the string END,
followed by one or more blank characters
and the string used in the corresponding category header.
<p>
The category body consists of one or more lines of text.
Each line contains an identifier, optionally followed by
one or more operands.
Identifiers are either keywords, identifying a particular locale
element, or collating elements.
In addition to the keywords defined in this specification, the source can
contain implementation-dependent keywords.
Each keyword within a locale must have a unique name
(that is, two categories cannot have a commonly-named keyword);
no keyword can start with the characters LC_.
Identifiers must be separated from the operands by one or more
blank characters.
<p>
Operands must be characters, collating elements
or strings of characters.
Strings must be enclosed in double-quotes.
Literal double-quotes within strings must be preceded by the
&lt;<i>escape character</i>&gt;,
described below.
When a keyword is followed
by more than one operand, the operands must be separated
by semicolons;
blank characters
are allowed both before and after a semicolon.
<p>
The first category header in the file can be preceded by
a line modifying the comment character.
It has the following format, starting in column 1:
<pre>
<dl compact><dt> <dd>
<tt>"comment_char %c\n"</tt>, &lt;<i>comment&nbsp;character</i>&gt;
</dl>
</pre>
<p>
The comment character defaults to the number sign
(#).
Blank lines and lines containing the
&lt;<i>comment&nbsp;character</i>&gt;
in the first position are ignored.
<p>
The first category header in the file can be preceded by
a line modifying the escape character to be used in the file.
It has the following format, starting in column 1:
<pre>
<dl compact><dt> <dd>
<tt>"escape_char %c\n"</tt>, &lt;<i>escape character</i>&gt;
</dl>
</pre>
<p>
The escape character defaults to backslash,
which is the character used in all examples shown in this specification.
<p>
A line can be continued by placing an escape character
as the last character on the line;
this continuation character will be discarded from the input.
Although the implementation need not accept
any one portion of a continued line
with a length exceeding
{LINE_MAX}
bytes, it places no limits on the
accumulated length of the continued line.
Comment lines cannot be continued on a subsequent line
using an escaped
newline character.
<p>
Individual characters, characters in strings, and collating
elements must be represented using symbolic names, as defined below.
In addition, characters can be represented using the
characters themselves or as octal, hexadecimal or decimal constants.
When non-symbolic notation is used, the resultant
locale definitions will in many cases not be portable between systems.
The left angle bracket
(&lt;)
is a reserved symbol, denoting the start of a symbolic name;
when used to
represent itself it must be preceded by the escape character.
The following rules apply to character representation:
<ol>
<p>
<li>
A character can be represented via a symbolic name, enclosed
within angle brackets "&lt;" and "&gt;".
The symbolic name, including
the angle brackets, must exactly match a symbolic name
defined in the charmap file specified via the
<i><a href="../xcu/localedef.html">localedef</a></i>
<b>-f</b>
option, and will be replaced by
a character value determined from the value associated with
the symbolic name in the charmap file.
The use of a symbolic name not found in the charmap
file constitutes an error, unless the category is
LC_CTYPE or LC_COLLATE,
in which case it constitutes a warning condition (see
<i><a href="../xcu/localedef.html">localedef</a></i>
for a description of action resulting from errors and warnings).
The specification of a symbolic name in a
<b>collating-element</b>
or
<b>collating-symbol</b>
section that duplicates a symbolic name
in the charmap file (if present) is an error.
Use of the escape character or a right angle bracket within
a symbolic name is invalid unless
the character is preceded by the escape character.
<p>
<b>Example</b>:
<code>
<pre>
&lt;c&gt;;&lt;c-cedilla&gt;  "&lt;M&gt;&lt;a&gt;&lt;y&gt;"
</code>
</pre>
<p>
<li>
A character can be represented by the character itself, in
which case the value of the character is implementation-dependent.
Within a string, the double-quote character, the escape
character and the right angle bracket character must be
escaped (preceded by the escape character) to be interpreted
as the character itself.
Outside strings, the characters:
<code>
<pre>
,     ;     &lt;     &gt;     <i>escape_char</i>
</code>
</pre>
must be escaped to be interpreted as the character itself.
<p>
<b>Example</b>:
<code>
<pre>
c  &szlig;   "May"
</code>
</pre>
<p>
<li>
A character can be represented as an octal constant.
An octal constant is specified as
the escape character
followed by two or more octal digits.
Each constant represents a byte value.
Multi-byte values can be represented by concatenated constants
specified in byte order with
the last constant specifying the least significant byte of the character.
<p>
<b>Example</b>:
<code>
<pre>
\143;\347;\143\150   "\115\141\171"
</code>
</pre>
<p>
<li>
A character can be represented as a hexadecimal constant.
A hexadecimal constant is specified as
the escape character followed by an
x
followed by two or more hexadecimal digits.
Each constant represents a byte value.
Multi-byte values can be represented by concatenated constants
specified in byte order with
the last constant specifying the least significant byte of the character.
<p>
<b>Example</b>:
<code>
<pre>
\x63;\xe7;\x63\x68   "\x4d\x61\x79"
</code>
</pre>
<p>
<li>
A character can be represented as a decimal constant.
A decimal constant
is specified as the escape character followed by a
d
followed by two or more decimal digits.
Each constant represents a byte value.
Multi-byte values can be represented
by concatenated constants
specified in byte order with
the last constant specifying the least significant byte of the character.
<p>
<b>Example</b>:
<code>
<pre>
\d99;\d231;\d99\d104  "\d77\d97\d121"
</code>
</pre>
<p>
</ol>
<p>
Implementations may accept single-digit octal,
decimal or hexadecimal constants following the escape character.
Only characters existing in the character set for which
the locale definition is created can be specified,
whether using symbolic names, the characters themselves,
or octal, decimal or hexadecimal constants.
If a charmap file is present, only characters defined
in the charmap can be specified
using octal, decimal or hexadecimal constants.
Symbolic names not present in the
charmap file can be specified and will be ignored, as
specified under item 1 above.
<br>
<h4><a name = "tag_005_003_001">&nbsp;</a>LC_CTYPE</h4>
<xref type="3" name="lc_ctype"></xref>
The LC_CTYPE
category defines character classification, case conversion and other
character attributes.
In addition, a series of characters can be represented by
three adjacent periods representing an ellipsis symbol (...).
The ellipsis specification is interpreted
as meaning that all values between the
values preceding and following it represent valid characters.
The ellipsis specification is valid only within
a single encoded character set;
that is, within a group of characters of the same size.
An ellipsis is
interpreted as including in the list all characters with an encoded
value higher than the encoded value of the character preceding the
ellipsis and lower than the encoded value of the character following
the ellipsis.
<p>
<b>Example</b>:
<code>
<pre>
\x30;...;\x39;
</code>
</pre>
includes in the character class all characters with encoded values
between the endpoints.
<p>
The following keywords are recognised.
In the descriptions, the term &quot;automatically included&quot;
means that it is not an error either to
include or omit any of the referenced characters;
the implementation will provide them if missing
(even if the entire keyword is missing)
and accept them silently if present.
When the implementation automatically includes
a missing character, it will have an encoded value
dependent on the charmap
file in effect (see the description of the
<i><a href="../xcu/localedef.html">localedef</a></i>
<b>-f</b>
option); otherwise, it will have a value
derived from an implementation-dependent character mapping.
<p>
The character classes
<b>digit</b>,
<b>xdigit</b>,
<b>lower</b>,
<b>upper</b>
and
<b>space</b>
have a set of automatically included characters.
These only need to
be specified if the character values (that is, encoding) differ
from the implementation default values.
It is not possible to define a locale without these
automatically included characters unless some
implementation extension is used to prevent their inclusion.
Such a definition would not be a proper superset of the
C or POSIX locale and thus, it might not be possible for
applications conforming to the XSI to work properly.
<dl compact>

<dt><b>upper</b><dd>Define characters to be classified as upper-case letters.

In the POSIX locale,
the 26 upper-case letters
are included:
<code>
<pre>
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
</code>
</pre>

In a locale definition file,
no character specified for the keywords
<b>cntrl</b>,
<b>digit</b>,
<b>punct</b>
or
<b>space</b>
can be specified.
The upper-case letters
A
to
Z,
as defined in
<xref href=charmap><a href="charset.html#tag_001_004">
Character Set Description File
</a></xref>
(the portable character set),
are automatically included in this class.


<dt><b>lower</b><dd>Define characters to be classified as lower-case letters.

In the POSIX locale,
the 26 lower-case letters
are included:
<code>
<pre>
a b c d e f g h i j k l m n o p q r s t u v w x y z
</code>
</pre>

In a locale definition file,
no character specified for the keywords
<b>cntrl</b>,
<b>digit</b>,
<b>punct</b>
or
<b>space</b>
can be specified.
The lower-case letters
a
to
z
of the portable character set
are automatically included in this class.

<dt><b>alpha</b><dd>Define characters to be classified as letters.

In the POSIX locale,
all characters in the classes
<b>upper</b>
and
<b>lower</b>
are included.

In a locale definition file,
no character specified for the keywords
<b>cntrl</b>,
<b>digit</b>,
<b>punct</b>
or
<b>space</b>
can be specified.
Characters classified as either
<b>upper</b>
or
<b>lower</b>
are automatically included in this class.

<dt><b>digit</b><dd>Define the characters to be classified as numeric digits.

In the POSIX locale, only:
<code>
<pre>
0 1 2 3 4 5 6 7 8 9
</code>
</pre>
are included.

In a locale definition file,
only the digits
0,
1,
2,
3,
4,
5,
6,
7,
8
and
9
can be specified,
and in
contiguous ascending sequence by numerical value.
The digits
0
to
9
of the portable character set
are automatically included in this class.

The definition of character class
<b>digit</b>
requires that only ten
characters  the ones defining digits  can be specified;
alternative digits (for example, Hindi or Kanji) cannot be specified here.
However, the encoding may vary if an implementation supports
more than one encoding.

<dt><b>space</b><dd>Define characters to be classified as white-space characters.

In the POSIX locale, at a minimum, the characters
space, form-feed, newline, carriage-return, tab and vertical-tab
are included.

In a locale definition file,
no character specified for the keywords
<b>upper</b>,
<b>lower</b>,
<b>alpha</b>,
<b>digit</b>,
<b>graph</b>
or
<b>xdigit</b>
can be specified.
The characters space, form-feed, newline, carriage-return,
tab and vertical-tab of the portable character set,
and any characters included in the class
<b>blank</b>
are automatically included in this class.

<dt><b>cntrl</b><dd>Define characters to be classified as control characters.

In the POSIX locale,
no characters in classes
<b>alpha</b>
or
<b>print</b>
are included.

In a locale definition file,
no character specified for the keywords
<b>upper</b>,
<b>lower</b>,
<b>alpha</b>,
<b>digit</b>,
<b>punct</b>,
<b>graph</b>,
<b>print</b>
or
<b>xdigit</b>
can be specified.

<dt><b>punct</b><dd>Define characters to be classified as punctuation characters.

In the POSIX locale, neither the space
character nor any characters in classes
<b>alpha</b>,
<b>digit</b>
or
<b>cntrl</b>
are included.

In a locale definition file,
no character specified for the keywords
<b>upper</b>,
<b>lower</b>,
<b>alpha</b>,
<b>digit</b>,
<b>cntrl</b>,
<b>xdigit</b>
or as the space character can be specified.


<dt><b>graph</b><dd>Define characters to be classified as printable characters, not including the
space
character.

In the POSIX locale,
all characters in classes
<b>alpha</b>,
<b>digit</b>
and
<b>punct</b>
are included;
no characters in class
<b>cntrl</b>
are included.

In a locale definition file,
characters specified for the keywords
<b>upper</b>,
<b>lower</b>,
<b>alpha</b>,
<b>digit</b>,
<b>xdigit</b>
and
<b>punct</b>
are automatically included in this class.
No character specified for the keyword
<b>cntrl</b>
can be specified.

<dt><b>print</b><dd>Define characters to be classified as printable characters, including the
space
character.

In the POSIX locale,
all characters in class
<b>graph</b>
are included;
no characters in class
<b>cntrl</b>
are included.

In a locale definition file,
characters specified for the keywords
<b>upper</b>,
<b>lower</b>,
<b>alpha</b>,
<b>digit</b>,
<b>xdigit</b>,
<b>punct</b>
and the space character are automatically included in this class.
No character specified for the keyword
<b>cntrl</b>
can be specified.

<dt><b>xdigit</b><dd>Define the characters to be classified as hexadecimal digits.

In the POSIX locale, only:
<code>
<pre>
0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
</code>
</pre>
are included.

In a locale definition file,
only the characters defined for the class
<b>digit</b>
can be specified, in
contiguous ascending sequence by numerical
value, followed by one or more sets of six characters
representing the hexadecimal digits 10 to 15 inclusive,
with each set in ascending order (for example
A,
B,
C,
D,
E,
F,
a,
b,
c,
d,
e,
f).
The digits
0
to
9,
the upper-case letters
A
to
F
and the lower-case letters
a
to
f
of the portable character set
are automatically included in this class.

The definition of character class
<b>xdigit</b>
requires that the characters included in character class
<b>digit</b>
be included here also.

<dt><b>blank</b><dd>Define characters to be classified as blank characters.

In the POSIX locale, only the space and tab characters are included.

In a locale definition file, the characters space and tab
are automatically included in this class.

<dt><b>charclass</b><dd>Define one or more locale-specific character class names
as strings separated by semicolons.
Each named character class can then be defined subsequently
in the LC_CTYPE definition.
A character class name consists of at least one and at most
{CHARCLASS_NAME_MAX}
bytes of alphanumeric characters from the
portable filename character set.
The first character of a character class name
cannot be a digit.
The name cannot match any of the LC_CTYPE
keywords defined in this specification.

<dt><i>charclass-name</i><dd>Define characters to be classified as belonging
to the named locale-specific character class.
In the POSIX locale, the locale-specific
named character classes need not exist.

If a class name is defined by a
<b>charclass</b>
keyword, but no characters are subsequently
assigned to it, this is not an error;
it represents a class without any characters belonging to it.

The
<i>charclass-name</i>
can be used as the
<i>property</i>
argument to the
<i><a href="../xsh/wctype.html">wctype()</a></i>
function, in regular expression and shell pattern-matching
bracket expressions, and by the
<i><a href="../xcu/tr.html">tr</a></i>
command.

<dt><b>toupper</b><dd>Define the mapping of lower-case letters to upper-case letters.

In the POSIX locale,
at a minimum, the 26 lower-case characters:
<code>
<pre>
a b c d e f g h i j k l m n o p q r s t u v w x y z
</code>
</pre>
are mapped to the corresponding 26 upper-case characters:
<code>
<pre>
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
</code>
</pre>

In a locale definition file,
the operand consists of character pairs, separated by semicolons.
The characters in each character pair are separated by a comma and
the pair enclosed by parentheses.
The first character in each pair is the lower-case letter, the
second the corresponding upper-case letter.
Only characters specified for the keywords
<b>lower</b>
and
<b>upper</b>
can be specified.
The lower-case letters
a
to
z,
and their corresponding upper-case letters
A
to
Z,
of the portable character set
are automatically included in this mapping,
but only when the
<b>toupper</b>
keyword is omitted from the locale definition.

<dt><b>tolower</b><dd>Define the mapping of upper-case letters to lower-case letters.

In the POSIX locale,
at a minimum, the 26 upper-case characters:
<code>
<pre>
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
</code>
</pre>


are mapped to the corresponding 26 lower-case characters:
<code>
<pre>
a b c d e f g h i j k l m n o p q r s t u v w x y z
</code>
</pre>

In a locale definition file,
the operand consists of character pairs, separated by semicolons.
The characters in each character pair are separated by a comma and
the pair enclosed by parentheses.
The first character in each pair is the upper-case letter, the
second the corresponding lower-case letter.
Only characters specified for the keywords
<b>lower</b>
and
<b>upper</b>
can be specified.
If the
<b>tolower</b>
keyword is omitted from the locale definition,
the mapping will be the
reverse mapping of the one specified for
<b>toupper</b>.

<dt><b>copy</b><dd>Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.

</dl>
<p>
The following table shows the character class combinations allowed.
<pre>
<table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>In</b>
<th colspan=11 align=center><b>Can Also Belong To</b>
<tr valign=top><th align=center><b>Class</b>
<th align=center>upper
<th align=left>lower
<th align=center>alpha
<th align=left>digit
<th align=center>space
<th align=left>cntrl
<th align=center>punct
<th align=left>graph
<th align=center>print
<th align=left>xdigit
<th align=center>blank
<tr valign=top><td align=left>upper 
<td align=center> &nbsp;
<td align=left>-
<td align=center>A
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>A
<td align=center>A
<td align=left>-
<td align=center>x
<tr valign=top><td align=left>lower 
<td align=center>-
<td align=left> &nbsp;
<td align=center>A
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>A
<td align=center>A
<td align=left>-
<td align=center>x
<tr valign=top><td align=left>alpha 
<td align=center>-
<td align=left>-
<td align=center> &nbsp;
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>A
<td align=center>A
<td align=left>-
<td align=center>x
<tr valign=top><td align=left>digit 
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left> &nbsp;
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>A
<td align=center>A
<td align=left>A
<td align=center>x
<tr valign=top><td align=left>space 
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center> &nbsp;
<td align=left>-
<td align=center>*
<td align=left>*
<td align=center>*
<td align=left>x
<td align=center>-
<tr valign=top><td align=left>cntrl 
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>-
<td align=left> &nbsp;
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>-
<tr valign=top><td align=left>punct 
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>-
<td align=left>x
<td align=center> &nbsp;
<td align=left>A
<td align=center>A
<td align=left>x
<td align=center>-
<tr valign=top><td align=left>graph 
<td align=center>-
<td align=left>-
<td align=center>-
<td align=left>-
<td align=center>-
<td align=left>x
<td align=center>-
<td align=left> &nbsp;
<td align=center>A
<td align=left>-
<td align=center>-
<tr valign=top><td align=left>print 
<td align=center>-
<td align=left>-
<td align=center>-
<td align=left>-
<td align=center>-
<td align=left>x
<td align=center>-
<td align=left>-
<td align=center> &nbsp;
<td align=left>-
<td align=center>-
<tr valign=top><td align=left>xdigit
<td align=center>-
<td align=left>-
<td align=center>-
<td align=left>-
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>A
<td align=center>A
<td align=left> &nbsp;
<td align=center>x
<tr valign=top><td align=left>blank 
<td align=center>x
<td align=left>x
<td align=center>x
<td align=left>x
<td align=center>A
<td align=left>-
<td align=center>*
<td align=left>*
<td align=center>*
<td align=left>x
<td align=center>&nbsp;
</table>
<h6 align=center><xref table="Valid Character Class Combinations"><a name="tagt_5">&nbsp;</a></xref>Table: Valid Character Class Combinations</h6>
<b>Notes:</b>
<dd><ol>
<li>
Explanation of codes:
<dl compact>

<dt>A<dd>Automatically included; see text.

<dt>-<dd>Permitted.

<dt>x<dd>Mutually exclusive.

<dt>*<dd>See note 2.
</dl>

<li>
The space character, which is part of the <b>space</b> and <b>blank</b> classes, 
cannot belong to <b>punct</b> or <b>graph</b>, but automatically belongs to 
the <b>print</b> class.  Other <b>space</b> or <b>blank</b> characters can 
be classified as any of <b>punct</b>, <b>graph</b> or <b>print</b>.

</ol>
</pre>
The character classifications for the POSIX locale follow;
the code listing depicting the
<i><a href="../xcu/localedef.html">localedef</a></i>
input, the table representing the same
information, sorted by character.
<code>
<pre>
LC_CTYPE
# The following is the POSIX locale LC_CTYPE.
# "alpha" is by default "upper" and "lower"
# "alnum" is by definition "alpha" and "digit"
# "print" is by default "alnum", "punct" and the &lt;space&gt; character
# "graph" is by default "alnum" and "punct"
#
upper    &lt;A&gt;;&lt;B&gt;;&lt;C&gt;;&lt;D&gt;;&lt;E&gt;;&lt;F&gt;;&lt;G&gt;;&lt;H&gt;;&lt;I&gt;;&lt;J&gt;;&lt;K&gt;;&lt;L&gt;;&lt;M&gt;;\
         &lt;N&gt;;&lt;O&gt;;&lt;P&gt;;&lt;Q&gt;;&lt;R&gt;;&lt;S&gt;;&lt;T&gt;;&lt;U&gt;;&lt;V&gt;;&lt;W&gt;;&lt;X&gt;;&lt;Y&gt;;&lt;Z&gt;
#
lower    &lt;a&gt;;&lt;b&gt;;&lt;c&gt;;&lt;d&gt;;&lt;e&gt;;&lt;f&gt;;&lt;g&gt;;&lt;h&gt;;&lt;i&gt;;&lt;j&gt;;&lt;k&gt;;&lt;l&gt;;&lt;m&gt;;\
         &lt;n&gt;;&lt;o&gt;;&lt;p&gt;;&lt;q&gt;;&lt;r&gt;;&lt;s&gt;;&lt;t&gt;;&lt;u&gt;;&lt;v&gt;;&lt;w&gt;;&lt;x&gt;;&lt;y&gt;;&lt;z&gt;
#
digit    &lt;zero&gt;;&lt;one&gt;;&lt;two&gt;;&lt;three&gt;;&lt;four&gt;;&lt;five&gt;;&lt;six&gt;;\
         &lt;seven&gt;;&lt;eight&gt;;&lt;nine&gt;
#
space    &lt;tab&gt;;&lt;newline&gt;;&lt;vertical-tab&gt;;&lt;form-feed&gt;;\
         &lt;carriage-return&gt;;&lt;space&gt;
#
cntrl    &lt;alert&gt;;&lt;backspace&gt;;&lt;tab&gt;;&lt;newline&gt;;&lt;vertical-tab&gt;;\
         &lt;form-feed&gt;;&lt;carriage-return&gt;;\
         &lt;NUL&gt;;&lt;SOH&gt;;&lt;STX&gt;;&lt;ETX&gt;;&lt;EOT&gt;;&lt;ENQ&gt;;&lt;ACK&gt;;&lt;SO&gt;;\
         &lt;SI&gt;;&lt;DLE&gt;;&lt;DC1&gt;;&lt;DC2&gt;;&lt;DC3&gt;;&lt;DC4&gt;;&lt;NAK&gt;;&lt;SYN&gt;;\
         &lt;ETB&gt;;&lt;CAN&gt;;&lt;EM&gt;;&lt;SUB&gt;;&lt;ESC&gt;;&lt;IS4&gt;;&lt;IS3&gt;;&lt;IS2&gt;;\
         &lt;IS1&gt;;&lt;DEL&gt;
#
punct    &lt;exclamation-mark&gt;;&lt;quotation-mark&gt;;&lt;number-sign&gt;;\
         &lt;dollar-sign&gt;;&lt;percent-sign&gt;;&lt;ampersand&gt;;&lt;apostrophe&gt;;\
         &lt;left-parenthesis&gt;;&lt;right-parenthesis&gt;;&lt;asterisk&gt;;\
         &lt;plus-sign&gt;;&lt;comma&gt;;&lt;hyphen&gt;;&lt;period&gt;;&lt;slash&gt;;\
         &lt;colon&gt;;&lt;semicolon&gt;;&lt;less-than-sign&gt;;&lt;equals-sign&gt;;\
         &lt;greater-than-sign&gt;;&lt;question-mark&gt;;&lt;commercial-at&gt;;\
         &lt;left-square-bracket&gt;;&lt;backslash&gt;;&lt;right-square-bracket&gt;;\
         &lt;circumflex&gt;;&lt;underscore&gt;;&lt;grave-accent&gt;;&lt;left-curly-bracket&gt;;\
         &lt;vertical-line&gt;;&lt;right-curly-bracket&gt;;&lt;tilde&gt;
#
xdigit   &lt;zero&gt;;&lt;one&gt;;&lt;two&gt;;&lt;three&gt;;&lt;four&gt;;&lt;five&gt;;&lt;six&gt;;&lt;seven&gt;;\
         &lt;eight&gt;;&lt;nine&gt;;&lt;A&gt;;&lt;B&gt;;&lt;C&gt;;&lt;D&gt;;&lt;E&gt;;&lt;F&gt;;&lt;a&gt;;&lt;b&gt;;&lt;c&gt;;&lt;d&gt;;&lt;e&gt;;&lt;f&gt;
#
blank    &lt;space&gt;;&lt;tab&gt;
#
toupper (&lt;a&gt;,&lt;A&gt;);(&lt;b&gt;,&lt;B&gt;);(&lt;c&gt;,&lt;C&gt;);(&lt;d&gt;,&lt;D&gt;);(&lt;e&gt;,&lt;E&gt;);\
        (&lt;f&gt;,&lt;F&gt;);(&lt;g&gt;,&lt;G&gt;);(&lt;h&gt;,&lt;H&gt;);(&lt;i&gt;,&lt;I&gt;);(&lt;j&gt;,&lt;J&gt;);\
        (&lt;k&gt;,&lt;K&gt;);(&lt;l&gt;,&lt;L&gt;);(&lt;m&gt;,&lt;M&gt;);(&lt;n&gt;,&lt;N&gt;);(&lt;o&gt;,&lt;O&gt;);\
        (&lt;p&gt;,&lt;P&gt;);(&lt;q&gt;,&lt;Q&gt;);(&lt;r&gt;,&lt;R&gt;);(&lt;s&gt;,&lt;S&gt;);(&lt;t&gt;,&lt;T&gt;);\
        (&lt;u&gt;,&lt;U&gt;);(&lt;v&gt;,&lt;V&gt;);(&lt;w&gt;,&lt;W&gt;);(&lt;x&gt;,&lt;X&gt;);(&lt;y&gt;,&lt;Y&gt;);(&lt;z&gt;,&lt;Z&gt;)
#
tolower (&lt;A&gt;,&lt;a&gt;);(&lt;B&gt;,&lt;b&gt;);(&lt;C&gt;,&lt;c&gt;);(&lt;D&gt;,&lt;d&gt;);(&lt;E&gt;,&lt;e&gt;);\
        (&lt;F&gt;,&lt;f&gt;);(&lt;G&gt;,&lt;g&gt;);(&lt;H&gt;,&lt;h&gt;);(&lt;I&gt;,&lt;i&gt;);(&lt;J&gt;,&lt;j&gt;);\
        (&lt;K&gt;,&lt;k&gt;);(&lt;L&gt;,&lt;l&gt;);(&lt;M&gt;,&lt;m&gt;);(&lt;N&gt;,&lt;n&gt;);(&lt;O&gt;,&lt;o&gt;);\
        (&lt;P&gt;,&lt;p&gt;);(&lt;Q&gt;,&lt;q&gt;);(&lt;R&gt;,&lt;r&gt;);(&lt;S&gt;,&lt;s&gt;);(&lt;T&gt;,&lt;t&gt;);\
        (&lt;U&gt;,&lt;u&gt;);(&lt;V&gt;,&lt;v&gt;);(&lt;W&gt;,&lt;w&gt;);(&lt;X&gt;,&lt;x&gt;);(&lt;Y&gt;,&lt;y&gt;);(&lt;Z&gt;,&lt;z&gt;)
END LC_CTYPE
</code>
</pre>
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b></b>
<tr valign=top><th align=center><b>Symbolic Name</b>
<th align=center><b>Other Case</b>
<th align=center><b>Character Classes</b>
<tr valign=top><td align=left>&lt;NUL&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;SOH&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;STX&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;ETX&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;EOT&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;ENQ&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;ACK&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;alert&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;backspace&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;tab&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl, space, blank</b>
<tr valign=top><td align=left>&lt;newline&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl, space</b>
<tr valign=top><td align=left>&lt;vertical-tab&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl, space</b>
<tr valign=top><td align=left>&lt;form-feed&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl, space</b>
<tr valign=top><td align=left>&lt;carriage-return&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl, space</b>
<tr valign=top><td align=left>&lt;SO&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;SI&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;DLE&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;DC1&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;DC2&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;DC3&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;DC4&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;NAK&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;SYN&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;ETB&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;CAN&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;EM&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;SUB&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;ESC&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;IS4&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;IS3&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;IS2&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;IS1&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
<tr valign=top><td align=left>&lt;space&gt;
<td align=center>&nbsp;
<td align=left><b>space, print, blank</b>
<tr valign=top><td align=left>&lt;exclamation-mark&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;quotation-mark&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;number-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;dollar-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;percent-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;ampersand&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;apostrophe&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;left-parenthesis&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;right-parenthesis&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;asterisk&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;plus-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;comma&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;hyphen&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;period&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;slash&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;zero&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;one&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;two&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;three&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;four&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;five&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;six&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;seven&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;eight&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;nine&gt;
<td align=center>&nbsp;
<td align=left><b>digit, xdigit, print, graph</b>
<tr valign=top><td align=left>&lt;colon&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;semicolon&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;less-than-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;equals-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;greater-than-sign&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;question-mark&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;commercial-at&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;A&gt;
<td align=center>&lt;a&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;B&gt;
<td align=center>&lt;b&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;C&gt;
<td align=center>&lt;c&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;D&gt;
<td align=center>&lt;d&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;E&gt;
<td align=center>&lt;e&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;F&gt;
<td align=center>&lt;f&gt;
<td align=left><b>upper, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;G&gt;
<td align=center>&lt;g&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;H&gt;
<td align=center>&lt;h&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;I&gt;
<td align=center>&lt;i&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;J&gt;
<td align=center>&lt;j&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;K&gt;
<td align=center>&lt;k&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;L&gt;
<td align=center>&lt;l&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;M&gt;
<td align=center>&lt;m&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;N&gt;
<td align=center>&lt;n&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;O&gt;
<td align=center>&lt;o&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;P&gt;
<td align=center>&lt;p&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;Q&gt;
<td align=center>&lt;q&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;R&gt;
<td align=center>&lt;r&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;S&gt;
<td align=center>&lt;s&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;T&gt;
<td align=center>&lt;t&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;U&gt;
<td align=center>&lt;u&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;V&gt;
<td align=center>&lt;v&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;W&gt;
<td align=center>&lt;w&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;X&gt;
<td align=center>&lt;x&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;Y&gt;
<td align=center>&lt;y&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;Z&gt;
<td align=center>&lt;z&gt;
<td align=left><b>upper, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;left-square-bracket&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;backslash&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;right-square-bracket&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;circumflex&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;underscore&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;grave-accent&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;a&gt;
<td align=center>&lt;A&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;b&gt;
<td align=center>&lt;B&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;c&gt;
<td align=center>&lt;C&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;d&gt;
<td align=center>&lt;D&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;e&gt;
<td align=center>&lt;E&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;f&gt;
<td align=center>&lt;F&gt;
<td align=left><b>lower, xdigit, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;g&gt;
<td align=center>&lt;G&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;h&gt;
<td align=center>&lt;H&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;i&gt;
<td align=center>&lt;I&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;j&gt;
<td align=center>&lt;J&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;k&gt;
<td align=center>&lt;K&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;l&gt;
<td align=center>&lt;L&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;m&gt;
<td align=center>&lt;M&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;n&gt;
<td align=center>&lt;N&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;o&gt;
<td align=center>&lt;O&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;p&gt;
<td align=center>&lt;P&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;q&gt;
<td align=center>&lt;Q&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;r&gt;
<td align=center>&lt;R&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;s&gt;
<td align=center>&lt;S&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;t&gt;
<td align=center>&lt;T&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;u&gt;
<td align=center>&lt;U&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;v&gt;
<td align=center>&lt;V&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;w&gt;
<td align=center>&lt;W&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;x&gt;
<td align=center>&lt;X&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;y&gt;
<td align=center>&lt;Y&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;z&gt;
<td align=center>&lt;Z&gt;
<td align=left><b>lower, alpha, print, graph</b>
<tr valign=top><td align=left>&lt;left-curly-bracket&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;vertical-line&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;right-curly-bracket&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;tilde&gt;
<td align=center>&nbsp;
<td align=left><b>punct, print, graph</b>
<tr valign=top><td align=left>&lt;DEL&gt;
<td align=center>&nbsp;
<td align=left><b>cntrl</b>
</table>
<h4><a name = "tag_005_003_002">&nbsp;</a>LC_COLLATE</h4>
<xref type="3" name="lc_collate"></xref>
The LC_COLLATE category
provides a collation sequence definition for numerous
utilities in the <b>XCU</b> specification
(<i><a href="../xcu/sort.html">sort</a></i>,
<i><a href="../xcu/uniq.html">uniq</a></i>,
and so forth), regular expression matching (see
<xref href=re><a href="re.html#tag_007">
Regular Expressions
</a></xref>)
and the
<i><a href="../xsh/strcoll.html">strcoll()</a></i>,
<i><a href="../xsh/strxfrm.html">strxfrm()</a></i>,
<i><a href="../xsh/wcscoll.html">wcscoll()</a></i>
and
<i><a href="../xsh/wcsxfrm.html">wcsxfrm()</a></i>
functions in the <b>XSH</b> specification.
<p>
A collation sequence definition defines the relative order between
collating elements (characters and multi-character collating elements)
in the locale.
This order is expressed in terms of collation values;
that is,
by assigning each element one or more collation values (also known
as collation weights).
This does not imply that implementations
assign such values, but that ordering of strings using the resultant
collation definition in the locale will behave as if such assignment
is done and used in the collation process.
At least the following capabilities are provided:
<ol>
<p>
<li>
<b>Multi-character collating elements</b>.
Specification of multi-character collating elements (that is, sequences of
two or more characters to be collated as an entity).
<p>
<li>
<b>User-defined ordering of collating elements</b>.
Each collating element is assigned a collation value defining
its order in the character (or basic) collation sequence.
This ordering
is used by regular expressions and pattern matching and, unless
collation weights are explicitly specified, also as the collation weight
to be used in sorting.
<p>
<li>
<b>Multiple weights and equivalence classes</b>.
Collating elements can be
assigned one or more (up to the limit
{COLL_WEIGHTS_MAX})
collating weights for use in sorting.
The first weight is hereafter referred to as the primary weight.
<p>
<li>
<b>One-to-Many mapping</b>.
A single character is mapped into a string of collating elements.
<p>
<li>
<b>Equivalence class definition</b>.
Two or more collating elements have the same collation value
(primary weight).
<p>
<li>
<b>Ordering by weights</b>.
When two strings are compared to determine
their relative order, the two strings are first broken up
into a series of collating elements; the elements in each successive pair
of elements are then compared according to the relative primary weights
for the elements.
If equal, and more than one weight has been
assigned, then the pairs of collating elements are recompared
according to the relative subsequent weights, until either a
pair of collating elements compare unequal or the weights are exhausted.
<p>
</ol>
<p>
The following keywords are recognised in
a collation sequence definition.
They are described in detail in the following sections.
<dl compact>

<dt><b>collating-element</b><dd>Define a collating-element
symbol representing a multi-character collating element.
This keyword is optional.

<dt><b>collating-symbol</b><dd>Define a collating symbol
for use in collation order statements.
This keyword is optional.

<dt><b>order_start</b><dd>Define collation rules.
This statement is followed by one or
more collation order statements, assigning
character collation values and collation
weights to collating elements.

<dt><b>order_end</b><dd>Specify the end of the collation-order statements.

<dt><b>copy</b><dd>Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.

</dl>
<h5><a name = "tag_005_003_002_001">&nbsp;</a>The collating-element Keyword</h5>
In addition to the collating elements in the character set, the
<b>collating-element</b>
keyword is used to define multi-character
collating elements.
The syntax is:
<p>
<dl compact><dt> <dd>
<tt>"collating-element %s from \"%s\"\n"</tt>, &lt;<i>collating-symbol</i>&gt;,
&lt;<i>string</i>&gt;
</dl>
</p>
<p>
The
&lt;<i>collating-symbol</i>&gt;
operand is a symbolic name,
enclosed between angle brackets
(&lt;
and
&gt;),
and must not duplicate
any symbolic name in the current charmap file (if any), or any other
symbolic name defined in this collation definition.
The string operand is a string of two or more characters that
collates as an entity.
A
&lt;<i>collating-element</i>&gt;
defined via this
keyword is only recognised with the LC_COLLATE category.
<p>
<b>Example</b>:
<code>
<pre>
collating-element &lt;ch&gt; from "&lt;c&gt;&lt;h&gt;"
collating-element &lt;e-acute&gt; from "&lt;acute&gt;&lt;e&gt;"
collating-element &lt;ll&gt; from "ll"
</code>
</pre>
<h5><a name = "tag_005_003_002_002">&nbsp;</a>The collating-symbol Keyword</h5>
This keyword will be used to define symbols for use in collation
sequence statements; that is,
between the
<b>order_start</b>
and the
<b>order_end</b>
keywords.
The syntax is:
<pre>
<dl compact><dt> <dd>
<tt>"collating-symbol %s\n"</tt>, &lt;<i>collating-symbol</i>&gt;
</dl>
</pre>
<p>
The
&lt;<i>collating-symbol</i>&gt;
is a symbolic name,
enclosed between angle brackets
(&lt;
and
&gt;),
and must not duplicate
any symbolic name in the current charmap file (if any), or any other
symbolic name defined in this collation definition.
A
&lt;<i>collating-symbol</i>&gt;
defined via this
keyword is only recognised with the LC_COLLATE category.
<p>
<b>Example</b>:
<code>
<pre>
collating-symbol &lt;UPPER_CASE&gt;
collating-symbol &lt;HIGH&gt;
</code>
</pre>
<p>
The
<b>collating-symbol</b>
keyword defines a symbolic name
that can be associated with a relative position in
the character order sequence.
While such a symbolic
name does not represent any collating element, it
can be used as a weight.
<h5><a name = "tag_005_003_002_003">&nbsp;</a>The order_start Keyword</h5>
The
<b>order_start</b>
keyword must precede collation order entries and
also defines the number of weights for this collation sequence
definition and other collation rules.
<p>
The syntax of the
<b>order_start</b>
keyword is:
<p>
<dl compact><dt> <dd>
<tt>"order_start %s;%s;...;%s\n"</tt>, &lt;<i>sort-rules</i>&gt;,
&lt;<i>sort-rules</i>&gt;
</dl>
</p>
<p>
The operands to the
<b>order_start</b>
keyword are optional.
If present, the operands define rules to be applied when
strings are compared.
The number of operands define how
many weights each element is assigned;
if no operands
are present, one
<b>forward</b>
operand is assumed.
If present, the first operand defines rules to be applied
when comparing strings using the first (primary) weight;
the second when comparing strings using the second weight,
and so on.
Operands are separated by semicolons
(;).
Each operand consists of one or more collation directives,
separated by commas
(,).
If the number of operands exceeds the
{COLL_WEIGHTS_MAX}
limit, the utility will issue a warning message.
The following directives will be supported:
<dl compact>

<dt><b>forward</b><dd>Specifies that comparison operations for the
weight level proceed from start of
string towards the end of string.

<dt><b>backward</b><dd>Specifies that comparison operations for the
weight level proceed from end of
string towards the beginning of string.

<dt><b>position</b><dd>Specifies that comparison operations for the
weight level will consider the relative
position of
elements in the strings not subject to
<b>IGNORE</b>.
The string containing an element not subject to
<b>IGNORE</b>
after the fewest collating elements subject to
<b>IGNORE</b>
from the start of the compare
will collate first.
If both strings contain a character not subject to
<b>IGNORE</b>
in the same relative position, the
collating values assigned to the elements will
determine the ordering.
In case of equality, subsequent characters not subject to
<b>IGNORE</b>
are considered in the same manner.

</dl>
<p>
The directives
<b>forward</b>
and
<b>backward</b>
are mutually exclusive.
<p>
<b>Example</b>:
<code>
<pre>
order_start    forward;backward
</code>
</pre>
<p>
If no operands are specified, a single
<b>forward</b>
operand is assumed.
<p>
The character (and collating element) order is defined by
the order in which characters and elements are specified
between the
<b>order_start</b>
and
<b>order_end</b>
keywords.
This character order is used in range expressions in regular expressions (see
<xref href=re><a href="re.html#tag_007">
Regular Expressions
</a></xref>).
Weights assigned to the characters and
elements define the collation sequence;
in the absence
of weights, the character order is also the collation sequence.
<p>
The
<b>position</b>
keyword provides the capability to
consider, in a compare, the relative position of
characters not subject to
<b>IGNORE</b>.
As an example, consider the two strings &quot;o-ring&quot; and &quot;or-ing&quot;.
Assuming the hyphen is subject to
<b>IGNORE</b>
on the first pass, the two strings will
compare equal, and the position of the hyphen is immaterial.
On second pass, all characters except the hyphen are subject to
<b>IGNORE</b>,
and in the normal case the two strings would again compare equal.
By taking position into account, the first collates before the second.
<h5><a name = "tag_005_003_002_004">&nbsp;</a>Collation Order</h5>
<xref type="5" name="collorder"></xref>
The
<b>order_start</b>
keyword is followed by collating identifier entries.
The syntax for the collating element entries is:
<p>
<dl compact><dt> <dd>
<tt>"%s %s;%s;...;%s\n"</tt>, &lt;<i>collating-identifier</i>&gt;,
&lt;<i>weight</i>&gt;,
&lt;<i>weight</i>&gt;,
...
</dl>
</p>
<p>
Each
<i>collating-identifier</i>
consists of either a character
(in any of the forms defined in
<xref href=locldefn><a href="#tag_005_003">
Locale Definition
</a></xref>),
a
&lt;<i>collating-element</i>&gt;,
a
&lt;<i>collating-symbol</i>&gt;,
an ellipsis or the special symbol
<b>UNDEFINED</b>.
The order in which collating elements are specified
determines the character
order sequence, such that each
collating element compares less than the elements following it.
The NUL character compares lower than any other character.
<p>
A
&lt;<i>collating-element</i>&gt;
is used to specify multi-character
collating elements, and indicates that the character sequence
specified via the
&lt;<i>collating-element</i>&gt;
is to be collated as
a unit and in the relative order specified by its place.
<p>
A
&lt;<i>collating-symbol</i>&gt;
is used to define a position in
the relative order for use in weights.
No weights are specified with a
&lt;<i>collating-symbol</i>&gt;.
<p>
The ellipsis symbol specifies that a sequence of
characters will collate according to their encoded character values.
It is interpreted as indicating that all characters with
a coded character set value higher than the value of the
character in the preceding line, and lower than the
coded character set value for the character in the following
line, in the current coded character set, will be placed in
the character collation order between the previous and the
following character in ascending order according to their coded
character set values.
An initial ellipsis is
interpreted as if the preceding line specified the NUL
character, and a trailing ellipsis as if the following line
specified the highest coded character set value in the
current coded character set.
An ellipsis is treated
as invalid if the preceding or following lines do not
specify characters in the current coded character set.
The use of the ellipsis symbol ties the definition to a
specific coded character set and may preclude the definition
from being portable between implementations.
<p>
The symbol
<b>UNDEFINED</b>
is interpreted as including all coded character set values
not specified explicitly or via the ellipsis symbol.
Such characters are inserted in the character collation
order at the point indicated by the symbol, and in
ascending order according to their coded character set values.
If no
<b>UNDEFINED</b>
symbol is specified, and the current coded character set
contains characters not specified in this section, the
utility will issue a warning message and place such
characters at the end of the character collation order.
<p>
The optional
operands for each collation-element are used to define the primary,
secondary, or subsequent weights for the collating element.
The first operand specifies the relative primary weight, the second
the relative secondary weight, and so on.
Two or more collation-elements can be assigned the same weight;
they belong to the same
if they have the same primary weight.
Collation behaves as if, for each weight level,
elements subject to
<b>IGNORE</b>
are removed,
unless the
<b>position</b>
collation directive is specified for
the corresponding level with the
<b>order_start</b>
keyword.
Then each successive pair of elements is compared according to the
relative weights for the elements.
If the two strings compare
equal, the process is repeated for the next weight level,
up to the limit
{COLL_WEIGHTS_MAX}.
<p>
Weights are expressed as characters (in any of the forms
specified in
<xref href=locldefn><a href="#tag_005_003">
Locale Definition
</a></xref>),
&lt;<i>collating-symbol</i>&gt;s,
&lt;<i>collating-element</i>&gt;s,
an ellipsis, or the special symbol
<b>IGNORE</b>.
A single character, a
&lt;<i>collating-symbol</i>&gt;
or a
&lt;<i>collating-element</i>&gt;
represent
the relative
position in the character collating sequence of the
character or symbol, rather than the character or characters themselves.
Thus, rather than assigning absolute values
to weights, a particular weight is expressed using the relative
order value assigned to a collating element based on its order
in the character collation sequence.
<p>
One-to-many mapping is indicated by specifying two or more
concatenated characters or symbolic names.
For example, if the character
&lt;eszet&gt;
is given the string
&lt;s&gt;&lt;s&gt;
as a weight,
comparisons are performed as if all occurrences of
the character
&lt;eszet&gt;
are replaced by
&lt;s&gt;&lt;s&gt;
(assuming that
&lt;s&gt;
has the collating weight
&lt;s&gt;).
If it is necessary to define
&lt;eszet&gt;
and
&lt;s&gt;&lt;s&gt;
as an equivalence class, then a
collating element must be defined for the string
ss.
<p>
All characters specified via an ellipsis will by default
be assigned unique weights, equal to the relative order of characters.
Characters specified via an explicit or implicit
<b>UNDEFINED</b>
special symbol will by default be assigned the same
primary weight (that is, belong to the same equivalence class).
An ellipsis symbol as a weight is interpreted to mean that
each character in the sequence has unique weights, equal
to the relative order of their character in the character collation sequence.
The use of the ellipsis as a weight is treated
as an error if the collating element is neither an ellipsis
nor the special symbol
<b>UNDEFINED</b>.
<p>
The special keyword
<b>IGNORE</b>
as a weight indicates that
when strings are compared using the weights at the level
where
<b>IGNORE</b>
is specified, the collating element is ignored; that is,
as if the string did not contain the collating element.
In regular expressions and pattern matching, all
characters that are subject to
<b>IGNORE</b>
in their primary weight form
an equivalence class.
<p>
An empty operand is interpreted as the collating element itself.
<p>
For example, the order statement:
<code>
<pre>
&lt;a&gt;    &lt;a&gt;;&lt;a&gt;
</code>
</pre>
is equal to:
<code>
<pre>
&lt;a&gt;
</code>
</pre>
<p>
An ellipsis can be used as an operand if the collating element was
an ellipsis, and is interpreted as the value of each character
defined by the ellipsis.
<p>
The collation order as defined in this section defines the
interpretation of bracket expressions in regular expressions
(see
<xref href=rebrack><a href="re.html#tag_007_003_005">
RE Bracket Expression
</a></xref>).
<br>
<p>
<b>Example</b>:
<pre>
<dl compact><dt> <dd>
<table <tr valign=top><td align=left>order_start
<td align=left>forward;backward
<tr valign=top><td align=left>UNDEFINED
<td align=left>IGNORE;IGNORE
<tr valign=top><td align=left>&lt;LOW&gt;
<tr valign=top><td align=left>&lt;space&gt;
<td align=left>&lt;LOW&gt;;&lt;space&gt;
<tr valign=top><td align=left>...
<td align=left>&lt;LOW&gt;;...
<tr valign=top><td align=left>&lt;a&gt;
<td align=left>&lt;a&gt;;&lt;a&gt;
<tr valign=top><td align=left>&lt;a-acute&gt;
<td align=left>&lt;a&gt;;&lt;a-acute&gt;
<tr valign=top><td align=left>&lt;a-grave&gt;
<td align=left>&lt;a&gt;;&lt;a-grave&gt;
<tr valign=top><td align=left>&lt;A&gt;
<td align=left>&lt;a&gt;;&lt;A&gt;
<tr valign=top><td align=left>&lt;A-acute&gt;
<td align=left>&lt;a&gt;;&lt;A-acute&gt;
<tr valign=top><td align=left>&lt;A-grave&gt;
<td align=left>&lt;a&gt;;&lt;A-grave&gt;
<tr valign=top><td align=left>&lt;ch&gt;
<td align=left>&lt;ch&gt;;&lt;ch&gt;
<tr valign=top><td align=left>&lt;Ch&gt;
<td align=left>&lt;ch&gt;;&lt;Ch&gt;
<tr valign=top><td align=left>&lt;s&gt;
<td align=left>&lt;s&gt;;&lt;s&gt;
<tr valign=top><td align=left>&lt;eszet&gt;
<td align=left>"&lt;s&gt;&lt;s&gt;";"&lt;eszet&gt;&lt;eszet&gt;"
<tr valign=top><td align=left>order_end
</table>
</dl>
</pre>
<p>
This example is interpreted as follows:
<ol>
<p>
<li>
The
<b>UNDEFINED</b>
means that all characters not specified in
this definition (explicitly or via the ellipsis) are
ignored for collation purposes; for regular expression
purposes they are ordered first.
<p>
<li>
All characters between
&lt;space&gt;
and
&lt;a&gt;
have the same primary equivalence class and individual secondary
weights based on their ordinal encoded values.
<p>
<li>
All characters based on the upper- or lower-case character
a
belong to the same primary equivalence class.
<p>
<li>
The multi-character collating element
&lt;ch&gt;
is represented by the collating symbol
&lt;ch&gt;
and belongs to the same primary equivalence class as the
multi-character collating element
&lt;Ch&gt;.
<p>
</ol>
<h5><a name = "tag_005_003_002_005">&nbsp;</a>The order_end Keyword</h5>
The collating order entries must be terminated with an
<b>order_end</b>
keyword.
<p>
The collation sequence definition of the POSIX locale follows; the
code listing depicts the
<i><a href="../xcu/localedef.html">localedef</a></i>
input.
<code>
<pre>
LC_COLLATE
# This is the POSIX locale definition for the LC_COLLATE category.
# The order is the same as in the ASCII codeset.
order_start forward
&lt;NUL&gt;
&lt;SOH&gt;
&lt;STX&gt;
&lt;ETX&gt;
&lt;EOT&gt;
&lt;ENQ&gt;
&lt;ACK&gt;
&lt;alert&gt;
&lt;backspace&gt;
&lt;tab&gt;
&lt;newline&gt;
&lt;vertical-tab&gt;
&lt;form-feed&gt;
&lt;carriage-return&gt;
&lt;SO&gt;
&lt;SI&gt;
&lt;DLE&gt;
&lt;DC1&gt;
&lt;DC2&gt;
&lt;DC3&gt;
&lt;DC4&gt;
&lt;NAK&gt;
&lt;SYN&gt;
&lt;ETB&gt;
&lt;CAN&gt;
&lt;EM&gt;
&lt;SUB&gt;
&lt;ESC&gt;
&lt;IS4&gt;
&lt;IS3&gt;
&lt;IS2&gt;
&lt;IS1&gt;
&lt;space&gt;
&lt;exclamation-mark&gt;
&lt;quotation-mark&gt;
&lt;number-sign&gt;
&lt;dollar-sign&gt;
&lt;percent-sign&gt;
&lt;ampersand&gt;
&lt;apostrophe&gt;
&lt;left-parenthesis&gt;
&lt;right-parenthesis&gt;
&lt;asterisk&gt;
&lt;plus-sign&gt;
&lt;comma&gt;
&lt;hyphen&gt;
&lt;period&gt;
&lt;slash&gt;
&lt;zero&gt;
&lt;one&gt;
&lt;two&gt;
&lt;three&gt;
&lt;four&gt;
&lt;five&gt;
&lt;six&gt;
&lt;seven&gt;
&lt;eight&gt;
&lt;nine&gt;
&lt;colon&gt;
&lt;semicolon&gt;
&lt;less-than-sign&gt;
&lt;equals-sign&gt;
&lt;greater-than-sign&gt;
&lt;question-mark&gt;
&lt;commercial-at&gt;
&lt;A&gt;
&lt;B&gt;
&lt;C&gt;
&lt;D&gt;
&lt;E&gt;
&lt;F&gt;
&lt;G&gt;
&lt;H&gt;
&lt;I&gt;
&lt;J&gt;
&lt;K&gt;
&lt;L&gt;
&lt;M&gt;
&lt;N&gt;
&lt;O&gt;
&lt;P&gt;
&lt;Q&gt;
&lt;R&gt;
&lt;S&gt;
&lt;T&gt;
&lt;U&gt;
&lt;V&gt;
&lt;W&gt;
&lt;X&gt;
&lt;Y&gt;
&lt;Z&gt;
&lt;left-square-bracket&gt;
&lt;backslash&gt;
&lt;right-square-bracket&gt;
&lt;circumflex&gt;
&lt;underscore&gt;
&lt;grave-accent&gt;
&lt;a&gt;
&lt;b&gt;
&lt;c&gt;
&lt;d&gt;
&lt;e&gt;
&lt;f&gt;
&lt;g&gt;
&lt;h&gt;
&lt;i&gt;
&lt;j&gt;
&lt;k&gt;
&lt;l&gt;
&lt;m&gt;
&lt;n&gt;
&lt;o&gt;
&lt;p&gt;
&lt;q&gt;
&lt;r&gt;
&lt;s&gt;
&lt;t&gt;
&lt;u&gt;
&lt;v&gt;
&lt;w&gt;
&lt;x&gt;
&lt;y&gt;
&lt;z&gt;
&lt;left-curly-bracket&gt;
&lt;vertical-line&gt;
&lt;right-curly-bracket&gt;
&lt;tilde&gt;
&lt;DEL&gt;
order_end
#
END LC_COLLATE
</code>
</pre>
<br>
<h4><a name = "tag_005_003_003">&nbsp;</a>LC_MONETARY</h4>
<xref type="3" name="lc_monetary"></xref>
The LC_MONETARY category defines the rules
and symbols that are used to format monetary
numeric information.
This information is available through the
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
function
and is used by the
<i><a href="../xsh/strfmon.html">strfmon()</a></i>
function.
<p>
Some of the information is also available in an alternative form
via the
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
function (see CRNCYSTR in
<i><a href="../xsh/langinfo.h.html">&lt;langinfo.h&gt;</a></i>).
<p>
The following items are defined in this category of the locale.
The item names are the
keywords recognised by the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility when defining a locale.
They are also similar to the
member names of the
<b>lconv</b>
structure defined in
<i><a href="../xsh/locale.h.html">&lt;locale.h&gt;</a></i>;
see the <b>XSH</b> specification for the exact symbols in the header.
The
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
function returns
{CHAR_MAX}
for unspecified integer items
and the empty string
()
for unspecified or size zero string items.
<p>
In a locale definition file,
the operands are strings,
formatted as indicated by the grammar in
<xref href=locgram><a href="#tag_005_004">
Locale Definition Grammar
</a></xref>.
For some keywords, the strings can contain only integers.
Keywords that are not provided,
string values set to the empty string
(),
or integer keywords set to -1, are
used to indicate that the value is
not available in the locale.
<dl compact>

<dt><b>int_curr_symbol</b><dd>The international currency symbol.
The operand is a four-character string, with the first three characters
containing the alphabetic international currency symbol in accordance
with those specified in the .
The fourth character
is the character used to separate the international currency symbol from
the monetary quantity.

<dt><b>currency_symbol</b><dd>The string used as the local currency symbol.

<dt><b>mon_decimal_point</b><dd>The operand is a string containing the symbol
that is used as the decimal delimiter
(radix character) in
monetary formatted quantities.
In contexts where standards (such as the ISO&nbsp;C standard) limit the
<b>mon_decimal_point</b>
to a single byte,
the result of specifying a multi-byte operand
is unspecified.

<dt><b>mon_thousands_sep</b><dd>The operand is a string containing the symbol
that is used as a separator for groups
of digits to the left of the decimal delimiter
in formatted monetary quantities.
In contexts
where standards limit the
<b>mon_thousands_sep</b>
to a single byte, the result of specifying a multi-byte
operand is unspecified.

<dt><b>mon_grouping</b><dd>Define the size of each group of digits in formatted monetary quantities.
The operand is
a sequence of integers separated by semicolons.
Each integer specifies the number
of digits in each group, with the initial
integer defining the size of the group immediately preceding the decimal
delimiter, and the following integers defining the preceding groups.
If the last integer is not -1, then the size of
the previous group (if any) will be repeatedly
used for the remainder of the digits.
If the last
integer is -1, then no further grouping will be performed.

The following is an example of the interpretation of the
<b>mon_grouping</b>
keyword.
Assuming that the value to be formatted is
123456789
and the
<b>mon_thousands_sep</b>
is
',
then the following table shows the result.
The third column shows the equivalent
string in the ISO&nbsp;C standard that would be used by the
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
function to accommodate
this grouping.

<table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>mon_grouping</b>
<th align=center><b>Formatted Value</b>
<th align=center><b>ISO C String</b>
<tr valign=top><td align=left>3;-1
<td align=left>123456'789
<td align=left>"\3\177"
<tr valign=top><td align=left>3
<td align=left>123'456'789
<td align=left>"\3"
<tr valign=top><td align=left>3;2;-1
<td align=left>1234'56'789
<td align=left>"\3\2\177"
<tr valign=top><td align=left>3;2
<td align=left>12'34'56'789
<td align=left>"\3\2"
<tr valign=top><td align=left>-1
<td align=left>123456789
<td align=left>"\177"
</table>

In these examples, the octal value of
{CHAR_MAX}
is 177.

<dt><b>positive_sign</b><dd>A string used to indicate
a non-negative-valued formatted monetary quantity.

<dt><b>negative_sign</b><dd>A string used to indicate
a negative-valued formatted monetary quantity.

<dt><b>int_frac_digits</b><dd>An integer representing
the number of fractional digits (those to the right of the decimal delimiter)
to be written in a formatted monetary quantity using
<b>int_curr_symbol</b>.


<dt><b>frac_digits</b><dd>An integer representing
the number of fractional digits (those to the right of the decimal delimiter)
to be written in a formatted monetary quantity using
<b>currency_symbol</b>.


<dt><b>p_cs_precedes</b><dd>An integer set to 1 if the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>
precedes the value for a monetary quantity with a non-negative value, and
set to 0 if the symbol succeeds the value.

<dt><b>p_sep_by_space</b><dd>An integer set to 0 if no space separates the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>
from the value for a monetary quantity with a non-negative value,
set to 1 if a space separates the symbol from
the value, and set to 2 if a space separates
the symbol and the sign string, if adjacent.


<dt><b>n_cs_precedes</b><dd>An integer set to 1 if the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>
precedes the value for a monetary quantity with a negative value, and
set to 0 if the symbol succeeds the value.

<dt><b>n_sep_by_space</b><dd>An integer set to 0 if no space separates the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>
from the value for a monetary quantity with a negative value,
set to 1 if a space separates the symbol from
the value, and set to 2 if a space separates
the symbol and the sign string, if adjacent.

<dt><b>p_sign_posn</b><dd>An integer set
to a value indicating the positioning of the
<b>positive_sign</b>
for a monetary quantity with a non-negative value.
The following integer values are recognised
for both
<b>p_sign_posn</b>
and
<b>n_sign_posn</b>:
<dl compact>

<dt><b>0</b><dd>Parentheses enclose the quantity and the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>.

<dt><b>1</b><dd>The sign string precedes the quantity and the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>.

<dt><b>2</b><dd>The sign string succeeds the quantity and the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>.

<dt><b>3</b><dd>The sign string precedes the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>.

<dt><b>4</b><dd>The sign string succeeds the
<b>currency_symbol</b>
or
<b>int_curr_symbol</b>.

</dl>
<p>
<dt><b>n_sign_posn</b><dd>An integer set to a value indicating the positioning of the
<b>negative_sign</b>
for a negative formatted monetary quantity.
<p>
<dt><b>copy</b><dd><b>Note:&nbsp;&nbsp;</b>
This is a
<i><a href="../xcu/localedef.html">localedef</a></i>
utility keyword, unavailable through
<i><a href="../xsh/localeconv.html">localeconv()</a></i>.
<p>
Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.
<p>
</dl>
<p>
The following table shows the result of various combinations:
<pre>
<table  bordercolor=#000000 border=1 align=center><tr valign=top>&nbsp;<th align=left>&nbsp;
<th align=left>&nbsp;
<th colspan=3 align=center><b>p_sep_by_space</b>
<tr valign=top><th align=left>&nbsp;
<th align=left>&nbsp;
<th align=center><b>2</b>
<th align=center><b>1</b>
<th align=center><b>0</b>
<tr valign=top><td align=left><b>p_cs_precedes</b> = 1
<td align=left><b>p_sign_posn</b> = 0
<td align=left>($1.25)
<td align=left>($ 1.25)
<td align=left>($1.25)
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 1
<td align=left>+ $1.25
<td align=left>+$ 1.25
<td align=left>+$1.25
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 2
<td align=left>$1.25 +
<td align=left>$ 1.25+
<td align=left>$1.25+
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 3
<td align=left>+ $1.25
<td align=left>+$ 1.25
<td align=left>+$1.25
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 4
<td align=left>$ +1.25
<td align=left>$+ 1.25
<td align=left>$+1.25
<tr valign=top><td align=left><b>p_cs_precedes</b> = 0
<td align=left><b>p_sign_posn</b> = 0
<td align=left>(1.25 $)
<td align=left>(1.25 $)
<td align=left>(1.25$)
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 1
<td align=left>+1.25 $
<td align=left>+1.25 $
<td align=left>+1.25$
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 2
<td align=left>1.25$ +
<td align=left>1.25 $+
<td align=left>1.25$+
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 3
<td align=left>1.25+ $
<td align=left>1.25 +$
<td align=left>1.25+$
<tr valign=top><td align=left>&nbsp;
<td align=left><b>p_sign_posn</b> = 4
<td align=left>1.25$ +
<td align=left>1.25 $+
<td align=left>1.25$+
</table>
</pre>
<p>
The monetary formatting definitions for the POSIX locale follow;
the code listing depicting the
<i><a href="../xcu/localedef.html">localedef</a></i>
input, the table representing the same
information with the addition of
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
and
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
formats.
All values are unspecified in the POSIX locale.
<code>
<pre>
LC_MONETARY
# This is the POSIX locale definition for
# the LC_MONETARY category.
#
int_curr_symbol      ""
currency_symbol      ""
mon_decimal_point    ""
mon_thousands_sep    ""
mon_grouping         -1
positive_sign        ""
negative_sign        ""
int_frac_digits      -1
p_cs_precedes        -1
p_sep_by_space       -1
n_cs_precedes        -1
n_sep_by_space       -1
p_sign_posn          -1
n_sign_posn          -1
#
END LC_MONETARY
</code>
</pre>
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Item</b>
<th align=center><b>POSIX locale Value</b>
<th align=center><b>langinfo constant</b>
<th align=center><b><i>localeconv</i>() Value</b>
<th align=center><b>localedef Value</b>
<tr valign=top><td align=left><b>currency_symbol</b>
<td align=center>n/a
<td align=center>CRNCYSTR
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>frac_digits</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>int_curr_symbol</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>int_frac_digits</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>mon_decimal_point</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>mon_thousands_sep</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>mon_grouping</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>positive_sign</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>negative_sign</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>p_cs_precedes</b>
<td align=center>n/a
<td align=center>CRNCYSTR
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>n_cs_precedes</b>
<td align=center>n/a
<td align=center>CRNCYSTR
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>p_sep_by_space</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>n_sep_by_space</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>p_sign_posn</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
<tr valign=top><td align=left><b>n_sign_posn</b>
<td align=center>n/a
<td align=center>-
<td align=center>CHAR_MAX
<td align=center>-1
</table>
<p>
In the preceding table, the
<b>langinfo Constant</b>
column represents an  extension.
The entry
<b>n/a</b>
indicates that the value is not available in the POSIX locale.
<br>
<h4><a name = "tag_005_003_004">&nbsp;</a>LC_NUMERIC</h4>
<xref type="3" name="lc_numeric"></xref>
The LC_NUMERIC category defines the rules
and symbols that will be used to format non-monetary
numeric information.
This information is available through the
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
function.
Some of the information is also available in an alternative form via the
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
function.
<p>
The following items are defined in this category of the locale.
The item names are the
keywords recognised by the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility when defining a locale.
They are also similar to the
member names of the
<i>lconv</i>
structure defined in
<i><a href="../xsh/locale.h.html">&lt;locale.h&gt;</a></i>;
see the <b>XSH</b> specification for the exact symbols in the header.
The
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
function returns
{CHAR_MAX}
for unspecified integer items
and the empty string
()
for unspecified or size zero string items.
<p>
In a locale definition file,
the operands are strings,
formatted as indicated by the grammar in
<xref href=locgram><a href="#tag_005_004">
Locale Definition Grammar
</a></xref>.
For some keywords, the strings only can contain integers.
Keywords that are not provided,
string values set to the empty string
(),
or integer keywords set to -1, will be
used to indicate that the value is
not available in the locale.
The following keywords are recognised:
<dl compact>

<dt><b>decimal_point</b><dd>The operand is a string containing the symbol
that is used as the decimal delimiter
(radix character) in
numeric, non-monetary formatted quantities.
This keyword cannot be omitted and cannot be set to the empty string.
In contexts where standards limit the
<b>decimal_point</b>
to a single byte,
the result of specifying a multi-byte operand
is unspecified.

<dt><b>thousands_sep</b><dd>The operand is a string containing the symbol
that is used as a separator for groups
of digits to the left of the decimal delimiter
in numeric, non-monetary formatted monetary quantities.
In contexts where standards limit the
<b>thousands_sep</b>
to a single byte, the result
of specifying a multi-byte operand is unspecified.

<dt><b>grouping</b><dd>Define the size of each group of digits in formatted non-monetary
quantities.
The operand is
a sequence of integers separated by semicolons.
Each integer specifies the number
of digits in each group, with the initial
integer defining the size of the group immediately preceding the decimal
delimiter, and the following integers defining the preceding groups.
If the last integer is not -1, then the size of
the previous group (if any) will be repeatedly
used for the remainder of the digits.
If the last
integer is -1, then no further grouping will be performed.

<dt><b>copy</b><dd><b>Note:&nbsp;&nbsp;</b>
This is a
<i><a href="../xcu/localedef.html">localedef</a></i>
utility keyword, unavailable through
<i><a href="../xsh/localeconv.html">localeconv()</a></i>.

Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.

</dl>
<p>
The non-monetary numeric formatting definitions for the POSIX locale follow;
the code listing depicting the
<i><a href="../xcu/localedef.html">localedef</a></i>
input, the table representing the same
information with the addition of
<i><a href="../xsh/localeconv.html">localeconv()</a></i>
values
and
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
constants.
<code>
<pre>
LC_NUMERIC
# This is the POSIX locale definition for
# the LC_NUMERIC category.
#
decimal_point    "&lt;period&gt;"
thousands_sep    ""
grouping         -1
#
END LC_NUMERIC
</code>
</pre>
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Item</b>
<th align=center><b>POSIX locale Value</b>
<th align=center><b>langinfo Constant</b>
<th align=center><b><i>localeconv</i>() Value</b>
<th align=center><b>localedef Value</b>
<tr valign=top><td align=left><b>decimal_point</b>
<td align=center>"."
<td align=center>RADIXCHAR
<td align=center>"."
<td align=center>.
<tr valign=top><td align=left><b>thousands_sep</b>
<td align=center>n/a
<td align=center>THOUSEP
<td align=center>""
<td align=center>""
<tr valign=top><td align=left><b>grouping</b>
<td align=center>n/a
<td align=center>-
<td align=center>""
<td align=center>-1
</table>
<p>
In the preceding table, the
<b>langinfo Constant</b>
column represents an  extension.
The entry
<b>n/a</b>
indicates that the value is not available in the POSIX locale.
<br>
<h4><a name = "tag_005_003_005">&nbsp;</a>LC_TIME</h4>
<xref type="3" name="lc_time"></xref>
The LC_TIME
category defines the interpretation of the field descriptors supported by the
<i><a href="../xcu/date.html">date</a></i>
utility and affects the behaviour of the
<i><a href="../xsh/strftime.html">strftime()</a></i>,
<i><a href="../xsh/wcsftime.html">wcsftime()</a></i>,
<i><a href="../xsh/strptime.html">strptime()</a></i>
and
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
functions.
Because the interfaces for C-language access and locale definition
differ significantly, they are described separately.
<h5><a name = "tag_005_003_005_001">&nbsp;</a>LC_TIME Locale Definition</h5>
For locale definition, the following mandatory keywords are recognised:
<dl compact>

<dt><b>abday</b><dd>Define the abbreviated weekday names, corresponding to the %a
field descriptor
(conversion specification in the
<i><a href="../xsh/strftime.html">strftime()</a></i>,
<i><a href="../xsh/wcsftime.html">wcsftime()</a></i>
and
<i><a href="../xsh/strptime.html">strptime()</a></i>
functions).
The operand consists of seven semicolon-separated strings,
each surrounded by double-quotes.
The first string is the abbreviated name of the
day corresponding to Sunday, the second the abbreviated
name of the day corresponding to Monday, and so on.


<dt><b>day</b><dd>Define the full weekday names, corresponding to the %A
field descriptor.
The operand consists of seven semicolon-separated strings,
each surrounded by double-quotes.
The first string is the full name of the
day corresponding to Sunday, the second the full
name of the day corresponding to Monday, and so on.

<dt><b>abmon</b><dd>Define the abbreviated month names, corresponding to the %b
field descriptor.
The operand consists of twelve semicolon-separated strings,
each surrounded by double-quotes.
The first string is the abbreviated name of the first month of
the year (January), the second the abbreviated name of the second
month, and so on.

<dt><b>mon</b><dd>Define the full month names, corresponding to the %B
field descriptor.
The operand consists of twelve semicolon-separated strings,
each surrounded by double-quotes.
The first string is the full name of the first month of
the year (January), the second the full name of the second
month, and so on.

<dt><b>d_t_fmt</b><dd>Define the appropriate date and time representation, corresponding
to the %c field descriptor.
The operand consists of a string, and can contain any combination
of characters and field descriptors.
In addition, the string can contain
escape sequences defined in
the table in
<xref href=escseq><a href="notation.html#tagt_6">
Escape Sequences and Associated Actions
</a></xref>
(<b>\\</b>,
<b>\a</b>,
<b>\b</b>,
<b>\f</b>,
<b>\n</b>,
<b>\r</b>,
<b>\t</b>,
<b>\v</b>).

<dt><b>d_fmt</b><dd>Define the appropriate date representation, corresponding
to the %x field descriptor.
The operand consists of a string, and can contain any combination
of characters and field descriptors.
In addition, the string can contain
escape sequences defined in
the table in
<xref href=escseq><a href="notation.html#tagt_6">
Escape Sequences and Associated Actions
</a></xref>.

<dt><b>t_fmt</b><dd>Define the appropriate time representation, corresponding
to the %X field descriptor.
The operand consists of a string, and can contain any combination
of characters and field descriptors.
In addition, the string can contain
escape sequences defined in
the table in
<xref href=escseq><a href="notation.html#tagt_6">
Escape Sequences and Associated Actions
</a></xref>.

<dt><b>am_pm</b><dd>Define the appropriate representation of the
<i>ante meridiem</i>
and
<i>post meridiem</i>
strings, corresponding to the %p field descriptor.
The operand consists of two strings, separated by a semicolon,
each surrounded by double-quotes.
The first string represents the
<i>ante meridiem</i>
designation, the
last string the
<i>post meridiem</i>
designation.

<dt><b>t_fmt_ampm</b><dd>Define the appropriate time representation in the 12-hour
clock format with
<b>am_pm</b>,
corresponding to the %r
field descriptor.
The operand consists of a string and can
contain any combination of characters and field descriptors.
If the string is empty, the 12-hour format is not
supported in the locale.


<dt><b>era</b><dd>Define how years are counted and displayed for each era in a locale.
The operand consists of semicolon-separated strings.
Each string is an era description segment with the format:
<code>
<pre>
<i>direction</i>:<i>offset</i>:<i>start_date</i>:<i>end_date</i>:<i>era_name</i>:<i>era_format</i>
</code>
</pre>
according to the definitions below.
There can be as many era
description segments as are necessary to describe the different eras.
<dl><dt><b>Note:</b>
<dd>The start of an era
might not be the earliest point
in the era  it may be the latest.
For example, the Christian
era BC starts on the day before January 1, AD 1, and increases
with earlier time.
</dl>
<dl compact>

<dt><i>direction</i><dd>Either a + or a - character.
The + character indicates that years closer to the
<i>start_date</i>
have lower numbers than those closer to the
<i>end_date</i>.
The - character indicates that years closer to the
<i>start_date</i>
have higher numbers than those closer to the
<i>end_date</i>.

<dt><i>offset</i><dd>The number of the year closest to the
<i>start_date</i>
in the era, corresponding to the %Ey field descriptor.

<dt><i>start_date</i><dd>A date in the form
<i>yyyy</i>/<i>mm</i>/<i>dd</i>,
where
<i>yyyy</i>,
<i>mm</i>
and
<i>dd</i>
are the year, month and day numbers respectively of the start of the era.
Years prior to AD 1 are represented as negative numbers.

<dt><i>end_date</i><dd>The ending date of the era, in the same format as the
<i>start_date</i>,
or one of the two special values -* or +*.
The value -* indicates that the ending date is the beginning of time.
The value +* indicates that the ending date is the end of time.

<dt><i>era_name</i><dd>A string representing the name of the era,
corresponding to the %EC field descriptor.

<dt><i>era_format</i><dd>A string for formatting the
year in the era, corresponding to the %EY field descriptor.

</dl>
<p>
<dt><b>era_d_fmt</b><dd>Define the format of the date in
alternative era notation, corresponding to the %Ex field descriptor.
<p>
<dt><b>era_t_fmt</b><dd>Define the locale's appropriate alternative time format,
corresponding to the %EX field descriptor.
<p>
<dt><b>era_d_t_fmt</b><dd>Define the locale's appropriate alternative date and time format,
corresponding to the %Ec field descriptor.
<p>
<dt><b>alt_digits</b><dd>Define alternative symbols for digits,
corresponding to the %O
field descriptor modifier.
The operand consists of
semicolon-separated strings,
each surrounded by double-quotes.
The first string
is the alternative symbol corresponding with
zero, the second string the symbol corresponding
with one, and so on.
Up to 100 alternative symbol
strings can be specified.
The %O modifier indicates that the string corresponding to the
value specified via the field descriptor
will be used instead of the value.
<p>
<dt><b>copy</b><dd>Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.
<p>
</dl>
<h5><a name = "tag_005_003_005_002">&nbsp;</a>LC_TIME C-language Access</h5>
The following information can be accessed.
These correspond to constants defined in
<i><a href="../xsh/langinfo.h.html">&lt;langinfo.h&gt;</a></i>
and used as arguments to the
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
function.
<dl compact>

<dt>ABDAY_<i>x</i><dd>The abbreviated weekday names (for example Sun), where
<i>x</i>
is a number from 1 to 7.

<dt>DAY_<i>x</i><dd>The full weekday names (for example Sunday), where
<i>x</i>
is a number from 1 to 7.

<dt>ABMON_<i>x</i><dd>The abbreviated month names (for example Jan), where
<i>x</i>
is a number from 1 to 12.

<dt>MON_<i>x</i><dd>The full month names (for example January), where
<i>x</i>
is a number from 1 to 12.

<dt>D_T_FMT<dd>The appropriate date and time representation.

<dt>D_FMT<dd>The appropriate date representation.

<dt>T_FMT<dd>The appropriate time representation.

<dt>AM_STR<dd>The appropriate ante-meridiem affix.

<dt>PM_STR<dd>The appropriate post-meridiem affix.

<dt>T_FMT_AMPM<dd>The appropriate time representation in the 12-hour clock
format with AM_STR and PM_STR.

<dt>ERA<dd>The era description segments, which describe how years are counted
and displayed for each era in a locale.
Each era description segment has the format:
<code>
<pre>
<i>direction</i>:<i>offset</i>:<i>start_date</i>:<i>end_date</i>:<i>era_name</i>:<i>era_format</i>
</code>
</pre>
according to the definitions below.
There will be as many era
description segments as are necessary
to describe the different eras.
Era description segments are separated by semicolons.
<dl><dt><b>Note:</b>
<dd>The start of an era might not be the earliest point
in the era  it may be the latest.
For example, the Christian
era BC starts on the day before January 1, AD 1, and increases
with earlier time.
</dl>
<dl compact>

<dt><i>direction</i><dd>Either a + or a - character.
The + character indicates that years closer to the
<i>start_date</i>
have lower numbers than those closer to the
<i>end_date</i>.
The - character indicates that years closer to the
<i>start_date</i>
have higher numbers than those closer to the
<i>end_date</i>.

<dt><i>offset</i><dd>The number of the year closest to the
<i>start_date</i>
in the era.

<dt><i>start_date</i><dd>A date in the form
<i>yyyy</i>/<i>mm</i>/<i>dd</i>,
where
<i>yyyy</i>,
<i>mm</i>
and
<i>dd</i>
are the year, month and day numbers respectively of the start of the era.
Years prior to AD 1 are represented as negative numbers.

<dt><i>end_date</i><dd>The ending date of the era, in the same format as the
<i>start_date</i>,
or one of the two special values -* or +*.
The value -* indicates that the ending date is the beginning of time.
The value +* indicates that the ending date is the end of time.

<dt><i>era_name</i><dd>The era,
corresponding to the
%EC
conversion specification.

<dt><i>era_format</i><dd>The format of the
year in the era, corresponding to the
%EY
conversion specification.

</dl>
<p>
<dt>ERA_D_FMT<dd>The era date format.
<p>
<dt>ERA_T_FMT<dd>The locale's appropriate alternative time format,
corresponding to the
%EX
field descriptor.
<p>
<dt>ERA_D_T_FMT<dd>The locale's appropriate alternative date and time format,
corresponding to the
%Ec
field descriptor.
<p>
<dt>ALT_DIGITS<dd>The alternative symbols for digits, corresponding to the
%O
conversion specification modifier.
The value consists of
semicolon-separated symbols.
The first is the alternative symbol corresponding to
zero, the second is the symbol corresponding
to one, and so on.
Up to 100 alternative symbols
may be specified.
<p>
</dl>
<p>
The following table displays the correspondence between the
items described above and the conversion specifiers used
by the
<i><a href="../xcu/date.html">date</a></i>
utility and the
<i><a href="../xsh/strftime.html">strftime()</a></i>,
<i><a href="../xsh/wcsftime.html">wcsftime()</a></i>
and
<i><a href="../xsh/strptime.html">strptime()</a></i>
functions.
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>localedef Keyword</b>
<th align=center><b>langinfo Constant</b>
<th align=center><b>Conversion Specifier</b>
<tr valign=top><td align=left><b>abday</b>
<td align=left>ABDAY_<i>x</i>
<td align=center>%a
<tr valign=top><td align=left><b>day</b>
<td align=left>DAY_<i>x</i>
<td align=center>%A
<tr valign=top><td align=left><b>abmon</b>
<td align=left>ABMON_<i>x</i>
<td align=center>%b
<tr valign=top><td align=left><b>mon</b>
<td align=left>MON
<td align=center>%B
<tr valign=top><td align=left><b>d_t_fmt</b>
<td align=left>D_T_FMT
<td align=center>%c
<tr valign=top><td align=left><b>d_fmt</b>
<td align=left>D_FMT
<td align=center>%x
<tr valign=top><td align=left><b>t_fmt</b>
<td align=left>T_FMT
<td align=center>%X
<tr valign=top><td align=left><b>am_pm</b>
<td align=left>AM_STR
<td align=center>%p
<tr valign=top><td align=left><b>am_pm</b>
<td align=left>PM_STR
<td align=center>%p
<tr valign=top><td align=left><b>t_fmt_ampm</b>
<td align=left>T_FMT_AMPM
<td align=center>%r
<tr valign=top><td align=left><b>era</b>
<td align=left>ERA
<td align=center>%EC,%Ey,%EY
<tr valign=top><td align=left><b>era_d_fmt</b>
<td align=left>ERA_D_FMT
<td align=center>%Ex
<tr valign=top><td align=left><b>era_t_fmt</b>
<td align=left>ERA_T_FMT
<td align=center>%EX
<tr valign=top><td align=left><b>era_d_t_fmt</b>
<td align=left>ERA_D_T_FMT
<td align=center>%Ec
<tr valign=top><td align=left><b>alt_digits</b>
<td align=left>ALT_DIGITS
<td align=center>%O
</table>
<p>
In the preceding table, the
<b>langinfo Constant</b>
column represents an  extension.
<h5><a name = "tag_005_003_005_003">&nbsp;</a>LC_TIME General Information</h5>
Although certain of the field descriptors in the POSIX locale
(such as the name of the month)
are shown with initial capital letters, this need not be
the case in other locales.
Programs using these fields may need to adjust the capitalisation
if the output is going to be used at the beginning of a sentence.
<p>
The LC_TIME descriptions of
<b>abday</b>,
<b>day</b>,
<b>mon</b>
and
<b>abmon</b>
imply a
Gregorian style calendar (7-day weeks, 12-month years, leap years,
and so forth).
Formatting time strings for other types of calendars is
outside the scope of this specification set.
<p>
As specified under
<i><a href="../xcu/date.html">date</a></i>
in the  and
<i><a href="../xsh/strftime.html">strftime()</a></i>,
in the <b>XSH</b> specification, the field descriptors
corresponding to the optional keywords consist of a modifier
followed by a traditional field descriptor (for instance %Ex).
If the optional keywords are not supported by the
implementation or are unspecified for the current locale, these
field descriptors are treated as the traditional field descriptor.
For instance, assume the following keywords:
<code>
<pre>
alt_digits    "0th";"1st";"2nd";"3rd";"4th";"5th";\
              "6th";"7th";"8th";"9th";"10th"

d_fmt        "The %Od day of %B in %Y"
</code>
</pre>
<p>
On 7/4/1776, the %x
field descriptor would result in
&quot;The 4th day of July in 1776&quot;, while 7/14/1789 would come out as
&quot;The 14 day of July in 1789&quot;.
It can be noted that the above example is for illustrative
purposes only; the %O modifier is primarily intended to provide
for Kanji or Hindi digits in
<i><a href="../xcu/date.html">date</a></i>
formats.
<p>
The following is an example for Japan that supports the current plus last
three Emperors and reverts to Western style numbering for years prior to
the Meiji era.
The example also allows for the custom of using a special
name for the first year of an era instead of using 1.
(The examples substitute romaji where kanji should be used.)
<code>
<pre>
era_d_fmt "%EY%mgatsu%dnichi (%a)"

era    "+:2:1990/01/01:+*:Heisei:%EC%Eynen";\
       "+:1:1989/01/08:1989/12/31:Heisei:%ECgannen";\
       "+:2:1927/01/01:1989/01/07:Shouwa:%EC%Eynen";\
       "+:1:1926/12/25:1926/12/31:Shouwa:%ECgannen";\
       "+:2:1913/01/01:1926/12/24:Taishou:%EC%Eynen";\
       "+:1:1912/07/30:1912/12/31:Taishou:%ECgannen";\
       "+:2:1869/01/01:1912/07/29:Meiji:%EC%Eynen";\
       "+:1:1868/09/08:1868/12/31:Meiji:%ECgannen";\
       "-:1868:1868/09/07:-*::%Ey"
</code>
</pre>
<p>
Assuming that the current date is September 21, 1991, a request to
<i><a href="../xcu/date.html">date</a></i>
or
<i><a href="../xsh/strftime.html">strftime()</a></i>
would yield the following results:
<code>
<pre>
%Ec - Heisei3nen9gatsu21nichi (Sat) 14:39:26
%EC - Heisei
%Ex - Heisei3nen9gatsu21nichi (Sat)
%Ey - 3
%EY - Heisei3nen
</code>
</pre>
<p>
Example era definitions for the Republic of China:
<code>
<pre>
era    "+:2:1913/01/01:+*:ChungHwaMingGuo:%EC%EyNen";\
       "+:1:1912/1/1:1912/12/31:ChungHwaMingGuo:%ECYuenNen";\
       "+:1:1911/12/31:-*:MingChien:%EC%EyNen"
</code>
</pre>
<p>
Example definitions for the Christian Era:
<code>
<pre>
era    "+:0:0000/01/01:+*:AD:%EC %Ey";\
       "+:1:-0001/12/31:-*:BC:%Ey %EC"
</code>
</pre>
<p>
<p>
The LC_TIME category definition of the POSIX locale follows; the
code listing depicts the
<i><a href="../xcu/localedef.html">localedef</a></i>
input;
the table depicts the
<i>langinfo</i>
items defined in this category.
<code>
<pre>
LC_TIME
# This is the POSIX locale definition for
# the LC_TIME category.
#
# Abbreviated weekday names (%a)
abday      "&lt;S&gt;&lt;u&gt;&lt;n&gt;";"&lt;M&gt;&lt;o&gt;&lt;n&gt;";"&lt;T&gt;&lt;u&gt;&lt;e&gt;";"&lt;W&gt;&lt;e&gt;&lt;d&gt;";\
           "&lt;T&gt;&lt;h&gt;&lt;u&gt;";"&lt;F&gt;&lt;r&gt;&lt;i&gt;";"&lt;S&gt;&lt;a&gt;&lt;t&gt;"
#
# Full weekday names (%A)
day        "&lt;S&gt;&lt;u&gt;&lt;n&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";"&lt;M&gt;&lt;o&gt;&lt;n&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";\
           "&lt;T&gt;&lt;u&gt;&lt;e&gt;&lt;s&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";"&lt;W&gt;&lt;e&gt;&lt;d&gt;&lt;n&gt;&lt;e&gt;&lt;s&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";\
           "&lt;T&gt;&lt;h&gt;&lt;u&gt;&lt;r&gt;&lt;s&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";"&lt;F&gt;&lt;r&gt;&lt;i&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;";\
           "&lt;S&gt;&lt;a&gt;&lt;t&gt;&lt;u&gt;&lt;r&gt;&lt;d&gt;&lt;a&gt;&lt;y&gt;"
#
# Abbreviated month names (%b)
abmon      "&lt;J&gt;&lt;a&gt;&lt;n&gt;";"&lt;F&gt;&lt;e&gt;&lt;b&gt;";"&lt;M&gt;&lt;a&gt;&lt;r&gt;";\
           "&lt;A&gt;&lt;p&gt;&lt;r&gt;";"&lt;M&gt;&lt;a&gt;&lt;y&gt;";"&lt;J&gt;&lt;u&gt;&lt;n&gt;";\
           "&lt;J&gt;&lt;u&gt;&lt;l&gt;";"&lt;A&gt;&lt;u&gt;&lt;g&gt;";"&lt;S&gt;&lt;e&gt;&lt;p&gt;";\
           "&lt;O&gt;&lt;c&gt;&lt;t&gt;";"&lt;N&gt;&lt;o&gt;&lt;v&gt;";"&lt;D&gt;&lt;e&gt;&lt;c&gt;"
#
# Full month names (%B)
mon        "&lt;J&gt;&lt;a&gt;&lt;n&gt;&lt;u&gt;&lt;a&gt;&lt;r&gt;&lt;y&gt;";"&lt;F&gt;&lt;e&gt;&lt;b&gt;&lt;r&gt;&lt;u&gt;&lt;a&gt;&lt;r&gt;&lt;y&gt;";\
           "&lt;M&gt;&lt;a&gt;&lt;r&gt;&lt;c&gt;&lt;h&gt;";"&lt;A&gt;&lt;p&gt;&lt;r&gt;&lt;i&gt;&lt;l&gt;";\
           "&lt;M&gt;&lt;a&gt;&lt;y&gt;";"&lt;J&gt;&lt;u&gt;&lt;n&gt;&lt;e&gt;";\
           "&lt;J&gt;&lt;u&gt;&lt;l&gt;&lt;y&gt;";"&lt;A&gt;&lt;u&gt;&lt;g&gt;&lt;u&gt;&lt;s&gt;&lt;t&gt;";\
           "&lt;S&gt;&lt;e&gt;&lt;p&gt;&lt;t&gt;&lt;e&gt;&lt;m&gt;&lt;b&gt;&lt;e&gt;&lt;r&gt;";"&lt;O&gt;&lt;c&gt;&lt;t&gt;&lt;o&gt;&lt;b&gt;&lt;e&gt;&lt;r&gt;";\
           "&lt;N&gt;&lt;o&gt;&lt;v&gt;&lt;e&gt;&lt;m&gt;&lt;b&gt;&lt;e&gt;&lt;r&gt;";"&lt;D&gt;&lt;e&gt;&lt;c&gt;&lt;e&gt;&lt;m&gt;&lt;b&gt;&lt;e&gt;&lt;r&gt;"
#
# Equivalent of AM/PM (%p)      "AM";"PM"
am_pm      "&lt;A&gt;&lt;M&gt;";"&lt;P&gt;&lt;M&gt;"
#
# Appropriate date and time representation (%c)
#    "%a %b %e %H:%M:%S %Y"
d_t_fmt    "&lt;percent-sign&gt;&lt;a&gt;&lt;space&gt;&lt;percent-sign&gt;&lt;b&gt;\
            &lt;space&gt;&lt;percent-sign&gt;&lt;e&gt;&lt;space&gt;&lt;percent-sign&gt;&lt;H&gt;\
            &lt;colon&gt;&lt;percent-sign&gt;&lt;M&gt;&lt;colon&gt;&lt;percent-sign&gt;&lt;S&gt;\
            &lt;space&gt;&lt;percent-sign&gt;&lt;Y&gt;"
#
# Appropriate date representation (%x)   "%m/%d/%y"
d_fmt      "&lt;percent-sign&gt;&lt;m&gt;&lt;slash&gt;&lt;percent-sign&gt;&lt;d&gt;\
            &lt;slash&gt;&lt;percent-sign&gt;&lt;y&gt;"
#
# Appropriate time representation (%X)   "%H:%M:%S"
t_fmt      "&lt;percent-sign&gt;&lt;H&gt;&lt;colon&gt;&lt;percent-sign&gt;&lt;M&gt;\
            &lt;colon&gt;&lt;percent-sign&gt;&lt;S&gt;"
#
# Appropriate 12-hour time representation (%r) "%I:%M:%S %p"
t_fmt_ampm "&lt;percent-sign&gt;&lt;I&gt;&lt;colon&gt;&lt;percent-sign&gt;&lt;M&gt;&lt;colon&gt;\
            &lt;percent-sign&gt;&lt;S&gt; &lt;percent_sign&gt;&lt;p&gt;"
#
END LC_TIME
</code>
</pre>
<br>
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Item</b>
<th align=center><b>POSIX Locale Value</b>
<th align=center><b>Item</b>
<th align=center><b>POSIX Locale Value</b>
<tr valign=top><td align=left><b>D_T_FMT</b>
<td align=left>"%a %b %e %H:%M:%S %Y"
<td align=left><b>MON_3</b>
<td align=left><i>"March"</i>
<tr valign=top><td align=left><b>D_FMT</b>
<td align=left>"%m/%d/%y"
<td align=left><b>MON_4</b>
<td align=left><i>"April"</i>
<tr valign=top><td align=left><b>T_FMT</b>
<td align=left>"%H:%M:%S"
<td align=left><b>MON_5</b>
<td align=left><i>"May"</i>
<tr valign=top><td align=left><b>AM_STR</b>
<td align=left>"AM"
<td align=left><b>MON_6</b>
<td align=left><i>"June"</i>
<tr valign=top><td align=left><b>PM_STR</b>
<td align=left>"PM"
<td align=left><b>MON_7</b>
<td align=left><i>"July"</i>
<tr valign=top><td align=left><b>T_FMT_AMPM</b>
<td align=left>"%I:%M:%S %p"
<td align=left><b>MON_8</b>
<td align=left><i>"August"</i>
<tr valign=top><td align=left><b>DAY_1</b>
<td align=left>"Sunday"
<td align=left><b>MON_9</b>
<td align=left><i>"September"</i>
<tr valign=top><td align=left><b>DAY_2</b>
<td align=left>"Monday"
<td align=left><b>MON_10</b>
<td align=left><i>"October"</i>
<tr valign=top><td align=left><b>DAY_3</b>
<td align=left>"Tuesday"
<td align=left><b>MON_11</b>
<td align=left><i>"November"</i>
<tr valign=top><td align=left><b>DAY_4</b>
<td align=left>"Wednesday"
<td align=left><b>MON_12</b>
<td align=left><i>"December"</i>
<tr valign=top><td align=left><b>DAY_5</b>
<td align=left>"Thursday"
<td align=left><b>ABMON_1</b>
<td align=left><i>"Jan"</i>
<tr valign=top><td align=left><b>DAY_6</b>
<td align=left>"Friday"
<td align=left><b>ABMON_2</b>
<td align=left><i>"Feb"</i>
<tr valign=top><td align=left><b>DAY_7</b>
<td align=left>"Saturday"
<td align=left><b>ABMON_3</b>
<td align=left><i>"Mar"</i>
<tr valign=top><td align=left><b>ABDAY_1</b>
<td align=left>"Sun"
<td align=left><b>ABMON_4</b>
<td align=left><i>"Apr"</i>
<tr valign=top><td align=left><b>ABDAY_2</b>
<td align=left>"Mon"
<td align=left><b>ABMON_5</b>
<td align=left><i>"May"</i>
<tr valign=top><td align=left><b>ABDAY_3</b>
<td align=left>"Tue"
<td align=left><b>ABMON_6</b>
<td align=left><i>"Jun"</i>
<tr valign=top><td align=left><b>ABDAY_4</b>
<td align=left>"Wed"
<td align=left><b>ABMON_7</b>
<td align=left><i>"Jul"</i>
<tr valign=top><td align=left><b>ABDAY_5</b>
<td align=left>"Thu"
<td align=left><b>ABMON_8</b>
<td align=left><i>"Aug"</i>
<tr valign=top><td align=left><b>ABDAY_6</b>
<td align=left>"Fri"
<td align=left><b>ABMON_9</b>
<td align=left><i>"Sep"</i>
<tr valign=top><td align=left><b>ABDAY_7</b>
<td align=left>"Sat"
<td align=left><b>ABMON_10</b>
<td align=left><i>"Oct"</i>
<tr valign=top><td align=left><b>MON_1</b>
<td align=left>"January"
<td align=left><b>ABMON_11</b>
<td align=left><i>"Nov"</i>
<tr valign=top><td align=left><b>MON_2</b>
<td align=left>"February"
<td align=left><b>ABMON_12</b>
<td align=left><i>"Dec"</i>
</table>
<h4><a name = "tag_005_003_006">&nbsp;</a>LC_MESSAGES</h4>
<xref type="3" name="lc_messages"></xref>
The LC_MESSAGES category defines the format and values for affirmative
and negative responses.
<p>
The message catalogue used by the standard utilities and selected by the
<i><a href="../xsh/catopen.html">catopen()</a></i>
function is determined by the setting of
<i>NLSPATH</i>
see
<xref href=envvar><a href="envvar.html#tag_002">
Environment Variables
</a></xref>.
The LC_MESSAGES category can be specified as part of an
<i>NLSPATH</i>
substitution field.
<p>
The following keywords are recognised as part of the locale definition file.
The
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
function accepts upper-case versions of the first four keywords.
<dl compact>

<dt><b>yesexpr</b><dd>The operand consists of an extended regular expression (see
<xref href=ere><a href="re.html#tag_007_004">
Extended Regular Expressions
</a></xref>)
that describes the acceptable affirmative
response to a question expecting an affirmative or negative response.

<dt><b>noexpr</b><dd>The operand consists of an extended regular expression that
describes the acceptable negative
response to a question expecting an affirmative or negative response.

<dt><b>yesstr</b> (<b>LEGACY</b>)<dd><br>
The operand consists of a fixed string
(not a regular expression) that
can be used by an application for composition of
a message that lists an acceptable affirmative response,
such as in a prompt.

<dt><b>nostr</b> (<b>LEGACY</b>)<dd><br>
The operand consists of a fixed string that
can be used by an application for composition of
a message that lists an acceptable negative response.

<dt>copy<dd>Specify the name of an existing locale to be used as
the definition of this category.
If this keyword is specified, no other keyword can be specified.

</dl>
<p>
Note that the
<b>yesstr</b>
and
<b>nostr</b>
values have different uses from those in Issue 3.
<p>
The format and values for affirmative and negative responses of
the POSIX locale follow; the code listing depicting the
<i><a href="../xcu/localedef.html">localedef</a></i>
input, the table representing the same information with the addition of
<i><a href="../xsh/nl_langinfo.html">nl_langinfo()</a></i>
constants.
<br>
<code>
<pre>
LC_MESSAGES
# This is the POSIX locale definition for
# the LC_MESSAGES category.
#
yesexpr  "&lt;circumflex&gt;&lt;left-square-bracket&gt;&lt;y&gt;&lt;Y&gt;&lt;right-square-bracket&gt;"
#
noexpr   "&lt;circumflex&gt;&lt;left-square-bracket&gt;&lt;n&gt;&lt;N&gt;&lt;right-square-bracket&gt;"
#
yesstr   "yes"
nostr    "no"
END LC_MESSAGES
</code>
</pre>
<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>localedef Keyword</b>
<th align=center><b>langinfo Constant</b>
<th align=center><b>POSIX Locale Value</b>
<tr valign=top><td align=left><b>yesexpr</b>
<td align=left>YESEXPR
<td align=left>"^[yY]"
<tr valign=top><td align=left><b>noexpr</b>
<td align=left>NOEXPR
<td align=left>"^[nN]"
<tr valign=top><td align=left><b>yesstr</b>
<td align=left>YESSTR
<td align=left>"yes"&nbsp;&nbsp;(<b>LEGACY</b>)  
<tr valign=top><td align=left><b>nostr</b>
<td align=left>NOSTR
<td align=left>"no"&nbsp;&nbsp;&nbsp;(<b>LEGACY</b>)  
</table>
<h5><a name = "tag_005_003_006_001">&nbsp;</a>LC_MESSAGES Application Usage</h5>
The
<b>yesstr</b>
and
<b>nostr</b>
locale keywords and the YESSTR and NOSTR
<i>langinfo</i>items
formerly were used to match user affirmative
and negative responses.
In this issue, the
<b>yesexpr</b>,
<b>noexpr</b>,
YESEXPR and NOEXPR
extended regular expressions have replaced them.
However, they have been retained for backward compatibility to allow
an application to include a sample desired
response in a prompting message.
They are marked <b>LEGACY</b>.
Applications should use the general locale-based
messaging facilities (see the <b>Internationalisation Guide</b>)
to issue such prompting messages.
<h3><a name = "tag_005_004">&nbsp;</a>Locale Definition Grammar</h3>
<xref type="2" name="locgram"></xref>
The grammar and lexical conventions in this section
together describe the syntax for the locale definition source.
The general conventions for this style of grammar are described in
the <b>XCU</b> specification, <b>Section 1.8</b>, <b>Grammar Conventions</b>.
The grammar takes precedence over the text.
<h4><a name = "tag_005_004_001">&nbsp;</a>Locale Lexical Conventions</h4>
The lexical conventions for the locale definition grammar are
described in this section.
<p>
The following tokens are processed (in addition to those string
constants shown in the grammar):
<dl compact>

<dt>LOC_NAME<dd>A string of characters representing the name of a locale.

<dt>CHAR<dd>Any single character.

<dt>NUMBER<dd>A decimal number, represented by one or more decimal digits.

<dt>COLLSYMBOL<dd>A symbolic name, enclosed between angle brackets.
The string cannot duplicate any charmap
symbol defined in the current charmap (if any), or a
<b>COLLELEMENT</b>
symbol.

<dt>COLLELEMENT<dd>A symbolic name, enclosed between angle brackets,
which cannot duplicate either any charmap symbol
or a
<b>COLLSYMBOL</b>
symbol.

<dt>CHARCLASS<dd>A string of alphanumeric characters from the portable character set,
the first of which is not a digit,
consisting of at least one and at most
{CHARCLASS_NAME_MAX}
bytes, and optionally surrounded by double-quotes.

<dt>CHARSYMBOL<dd>A symbolic name, enclosed between angle brackets,
from the current charmap (if any).

<dt>OCTAL_CHAR<dd>One or more octal representations of the encoding
of each byte in a single character.
The octal representation
consists of an escape character
(normally a backslash) followed
by two or more octal digits.

<dt>HEX_CHAR<dd>One or more hexadecimal representations of the
encoding of each byte in a single character.
The hexadecimal representation consists of an
escape character followed by the constant x
and two or more hexadecimal digits.

<dt>DECIMAL_CHAR<dd>One or more decimal representations of the
encoding of each byte in a single character.
The decimal representation consists of an escape character
followed by a character d and two or more decimal digits.

<dt>ELLIPSIS<dd>The string ...

<dt>EXTENDED_REG_EXP<dd>An extended regular expression as defined in the grammar in
<xref href=regram><a href="re.html#tag_007_005">
Regular Expression Grammar
</a></xref>.

<dt>EOL<dd>The line termination character
newline.

</dl>
<h4><a name = "tag_005_004_002">&nbsp;</a>Locale Grammar</h4>
This section presents the grammar for the locale definition.
<code>
<pre>
%token              LOC_NAME
%token              CHAR
%token              NUMBER
%token              COLLSYMBOL COLLELEMENT
%token              CHARSYMBOL OCTAL_CHAR HEX_CHAR DECIMAL_CHAR
%token              ELLIPSIS
%token              EXTENDED_REG_EXP
%token              EOL

%start              locale_definition

%%

locale_definition   : global_statements locale_categories
                    |                   locale_categories
                    ;

global_statements   : global_statements symbol_redefine
                    | symbol_redefine
                    ;

symbol_redefine     : 'escape_char'  CHAR EOL
                    | 'comment_char' CHAR EOL
                    ;
locale_categories   : locale_categories locale_category
                    | locale_category
                    ;

locale_category     : lc_ctype   | lc_collate | lc_messages
                    | lc_monetary | lc_numeric | lc_time
                    ;

/* The following grammar rules are common to all categories */

char_list           : char_list char_symbol
                    | char_symbol
                    ;

char_symbol         : CHAR   | CHARSYMBOL
                    | OCTAL_CHAR | HEX_CHAR | DECIMAL_CHAR
                    ;

elem_list           : elem_list char_symbol
                    | elem_list COLLSYMBOL
                    | elem_list COLLELEMENT
                    | char_symbol
                    | COLLSYMBOL
                    | COLLELEMENT
                    ;

symb_list           : symb_list COLLSYMBOL
                    | COLLSYMBOL
                    ;

locale_name         : LOC_NAME
                    | '"' LOC_NAME '"'
                    ;

/* The following is the LC_CTYPE category grammar */

lc_ctype            : ctype_hdr ctype_keywords         ctype_tlr
                    | ctype_hdr 'copy' locale_name EOL ctype_tlr
                    ;

ctype_hdr           : 'LC_CTYPE' EOL
                    ;

ctype_keywords      : ctype_keywords ctype_keyword
                    | ctype_keyword
                    ;

ctype_keyword       : charclass_keyword charclass_list EOL
                    | charconv_keyword charconv_list EOL
                    | 'charclass' charclass_namelist EOL
                    ;
charclass_namelist  : charclass_namelist '  ;' CHARCLASS
                    | CHARCLASS
                    ;

charclass_keyword   : 'upper'   | 'lower' | 'alpha' | 'digit'
                    | 'punct' | 'xdigit' | 'space' | 'print'
                    | 'graph' | 'blank' | 'cntrl'
                    | CHARCLASS
                    ;
charclass_list      : charclass_list '  ;' char_symbol
                    | charclass_list '  ;' ELLIPSIS ';' char_symbol
                    | char_symbol
                    ;

charconv_keyword    : 'toupper'
                    | 'tolower'
                    ;

charconv_list       : charconv_list '  ;' charconv_entry
                    | charconv_entry
                    ;
charconv_entry      : '(' char_symbol ',' char_symbol ')'
                    ;

ctype_tlr           : 'END' 'LC_CTYPE' EOL
                    ;

/* The following is the LC_COLLATE category grammar */

lc_collate          : collate_hdr collate_keywords       collate_tlr
                    | collate_hdr 'copy' locale_name EOL collate_tlr
                    ;

collate_hdr         : 'LC_COLLATE' EOL
                    ;

collate_keywords    :                order_statements
                    | opt_statements order_statements
                    ;

opt_statements      : opt_statements collating_symbols
                    | opt_statements collating_elements
                    | collating_symbols
                    | collating_elements
                    ;

collating_symbols   : 'collating-symbol' COLLSYMBOL EOL
                    ;

collating_elements  : 'collating-element' COLLELEMENT
                    'from' '"' elem_list '"' EOL
                    ;

order_statements    : order_start collation_order order_end
                    ;

order_start         : 'order_start' EOL
                    | 'order_start' order_opts EOL
                    ;

order_opts          : order_opts '  ;' order_opt
                    | order_opt
                    ;

order_opt           : order_opt ',' opt_word
                    | opt_word
                    ;

opt_word            : 'forward'   | 'backward' | 'position'
                    ;

collation_order     : collation_order collation_entry
                    | collation_entry
                    ;

collation_entry     : COLLSYMBOL EOL
                    | collation_element weight_list EOL
                    | collation_element             EOL
                    ;

collation_element   : char_symbol
                    | COLLELEMENT
                    | ELLIPSIS
                    | 'UNDEFINED'
                    ;

weight_list         : weight_list '  ;' weight_symbol
                    | weight_list '  ;'
                    | weight_symbol
                    ;

weight_symbol       : /* empty */
                    | char_symbol
                    | COLLSYMBOL
                    | '"' elem_list '"'
                    | '"' symb_list '"'
                    | ELLIPSIS
                    | 'IGNORE'
                    ;

order_end           : 'order_end' EOL
                    ;

collate_tlr         : 'END' 'LC_COLLATE' EOL
                    ;

/* The following is the LC_MESSAGES category grammar */

lc_messages         : messages_hdr messages_keywords      messages_tlr
                    | messages_hdr 'copy' locale_name EOL messages_tlr
                    ;

messages_hdr        : 'LC_MESSAGES' EOL
                    ;

messages_keywords   : messages_keywords messages_keyword
                    | messages_keyword
                    ;

messages_keyword    : 'yesexpr' '"' EXTENDED_REG_EXP '"' EOL
                    | 'noexpr'  '"' EXTENDED_REG_EXP '"' EOL
                    | 'yesstr'  '"' char_list '"' EOL
                    | 'nostr'   '"' char_list '"' EOL
                    ;

messages_tlr        : 'END' 'LC_MESSAGES' EOL
                    ;

/* The following is the LC_MONETARY category grammar */

lc_monetary         : monetary_hdr monetary_keywords       monetary_tlr
                    | monetary_hdr 'copy' locale_name EOL  monetary_tlr
                    ;

monetary_hdr        : 'LC_MONETARY' EOL
                    ;

monetary_keywords   : monetary_keywords monetary_keyword
                    | monetary_keyword
                    ;

monetary_keyword    : mon_keyword_string mon_string EOL
                    | mon_keyword_char NUMBER EOL
                    | mon_keyword_char '-1'   EOL
                    | mon_keyword_grouping mon_group_list EOL
                    ;

mon_keyword_string  : 'int_curr_symbol'   | 'currency_symbol'
                    | 'mon_decimal_point' | 'mon_thousands_sep'
                    | 'positive_sign' | 'negative_sign'
                    ;

mon_string          : '"' char_list '"'
                    | '""'
                    ;

mon_keyword_char    : 'int_frac_digits'   | 'frac_digits'
                    | 'p_cs_precedes' | 'p_sep_by_space'
                    | 'n_cs_precedes' | 'n_sep_by_space'
                    | 'p_sign_posn' | 'n_sign_posn'
                    ;

mon_keyword_grouping  : 'mon_grouping'
                    ;

mon_group_list      : NUMBER
                    | mon_group_list '  ;' NUMBER
                    ;

monetary_tlr        : 'END' 'LC_MONETARY' EOL
                    ;

/* The following is the LC_NUMERIC category grammar */

lc_numeric          : numeric_hdr numeric_keywords       numeric_tlr
                    | numeric_hdr 'copy' locale_name EOL numeric_tlr
                    ;

numeric_hdr         : 'LC_NUMERIC' EOL
                    ;

numeric_keywords    : numeric_keywords numeric_keyword
                    | numeric_keyword
                    ;

numeric_keyword     : num_keyword_string num_string EOL
                    | num_keyword_grouping num_group_list EOL
                    ;

num_keyword_string  : 'decimal_point'
                    | 'thousands_sep'
                    ;

num_string          : '"' char_list '"'
                    | '""'
                    ;

num_keyword_grouping: 'grouping'
                    ;

num_group_list      : NUMBER
                    | num_group_list '  ;' NUMBER
                    ;

numeric_tlr         : 'END' 'LC_NUMERIC' EOL
                    ;

/* The following is the LC_TIME category grammar */

lc_time             : time_hdr time_keywords          time_tlr
                    | time_hdr 'copy' locale_name EOL time_tlr
                    ;

time_hdr            : 'LC_TIME' EOL
                    ;

time_keywords       : time_keywords time_keyword
                    | time_keyword
                    ;

time_keyword        : time_keyword_name time_list EOL
                    | time_keyword_fmt time_string EOL
                    | time_keyword_opt time_list EOL
                    ;

time_keyword_name   : 'abday'   | 'day' | 'abmon' | 'mon'
                    ;

time_keyword_fmt    : 'd_t_fmt'   | 'd_fmt' | 't_fmt'
                    | 'am_pm' | 't_fmt_ampm'
                    ;

time_keyword_opt    : 'era'   | 'era_d_fmt' | 'era_t_fmt'
                    | 'era_d_t_fmt' | 'alt_digits'
                    ;

time_list           : time_list '  ;' time_string
                    | time_string
                    ;

time_string         : '"' char_list '"'
                    ;

time_tlr            : 'END' 'LC_TIME' EOL
                    ;
</code>
</pre>
<h3><a name = "tag_005_005">&nbsp;</a>Locale Definition Example</h3>
The following is an example of a locale definition file
that could be used as input to the
<i><a href="../xcu/localedef.html">localedef</a></i>
utility.
It assumes that the utility is executed with the
<b>-f</b>
option, naming a
<i>charmap</i>
file with (at least) the following content:
<code>
<pre>
CHARMAP
&lt;space&gt;      \x20
&lt;dollar&gt;     \x24
&lt;A&gt;          \101
&lt;a&gt;          \141
&lt;A-acute&gt;    \346
&lt;a-acute&gt;    \365
&lt;A-grave&gt;    \300
&lt;a-grave&gt;    \366
&lt;b&gt;          \142
&lt;C&gt;          \103
&lt;c&gt;          \143
&lt;c-cedilla&gt;  \347
&lt;d&gt;          \x64
&lt;H&gt;          \110
&lt;h&gt;          \150
&lt;eszet&gt;      \xb7
&lt;s&gt;          \x73
&lt;z&gt;          \x7a
END CHARMAP
</code>
</pre>
<p>
It should not be taken as complete or to represent any actual locale,
but only to illustrate the syntax.
<p>
A further set of examples is offered as part of the <b>Internationalisation Guide</b>.
<code>
<pre>
#
LC_CTYPE
lower   &lt;a&gt;;&lt;b&gt;;&lt;c&gt;;&lt;c-cedilla&gt;;&lt;d&gt;;...;&lt;z&gt;
upper   A;B;C;C;...;Z
space   \x20;\x09;\x0a;\x0b;\x0c;\x0d
blank   \040;\011
toupper (&lt;a&gt;,&lt;A&gt;);(b,B);(c,C);(c,C);(d,D);(z,Z)
END LC_CTYPE
#
LC_COLLATE
#
# The following example of collation is based on the proposed
# Canadian standard Z243.4.1-1990, "Canadian Alphanumeric
# Ordering Standard For Character sets of CSA Z234.4 Standard".
# (Other parts of this example locale definition file do not
# purport to relate to Canada, or to any other real culture.)
# The proposed standard defines a 4-weight collation, such that
# in the first pass, characters are compared without regard to
# case or accents; in second pass, backwards compare without
# regard to case; in the third pass, forward compare without
# regard to diacriticals.  In the 3 first passes, non-alphabetic
# characters are ignored; in the fourth pass, only special
# characters are considered, such that "The string that has a
# special character in the lowest position comes first.  If two
# strings have a special character in the same position, the
# collation value of the special character determines ordering.
#
# Only a subset of the character set is used here; mostly to
# illustrate the set-up.
#
#
collating-symbol &lt;LOW_VALUE&gt;
collating-symbol &lt;LOWER-CASE&gt;
collating-symbol &lt;SUBSCRIPT-LOWER&gt;
collating-symbol &lt;SUPERSCRIPT-LOWER&gt;
collating-symbol &lt;UPPER-CASE&gt;
collating-symbol &lt;NO-ACCENT&gt;
collating-symbol &lt;PECULIAR&gt;
collating-symbol &lt;LIGATURE&gt;
collating-symbol &lt;ACUTE&gt;
collating-symbol &lt;GRAVE&gt;
# Further collating-symbols follow.
#
# Properly, the standard does not include any multi-character
# collating elements; the one below is added for completeness.
#
collating_element &lt;ch&gt; from "&lt;c&gt;&lt;h&gt;"
collating_element &lt;CH&gt; from "&lt;C&gt;&lt;H&gt;"
collating_element &lt;Ch&gt; from "&lt;C&gt;&lt;h&gt;"
#
order_start forward;backward;forward;forward,position
#
# Collating symbols are specified first in the sequence to allocate
# basic collation values to them, lower than that of any character.
&lt;LOW_VALUE&gt;
&lt;LOWER-CASE&gt;
&lt;SUBSCRIPT-LOWER&gt;
&lt;SUPERSCRIPT-LOWER&gt;
&lt;UPPER-CASE&gt;
&lt;NO-ACCENT&gt;
&lt;PECULIAR&gt;
&lt;LIGATURE&gt;
&lt;ACUTE&gt;
&lt;GRAVE&gt;
&lt;RING-ABOVE&gt;
&lt;DIAERESIS&gt;
&lt;TILDE&gt;
# Further collating symbols are given a basic collating value here.
#
# Here follow special characters.
&lt;space&gt;        IGNORE;IGNORE;IGNORE;&lt;space&gt;
# Other special characters follow here.
#
# Here follow the regular characters.
&lt;a&gt;        &lt;a&gt;;&lt;NO-ACCENT&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;A&gt;        &lt;a&gt;;&lt;NO-ACCENT&gt;;&lt;UPPER-CASE&gt;;IGNORE
&lt;a-acute&gt;  &lt;a&gt;;&lt;ACUTE&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;A-acute&gt;  &lt;a&gt;;&lt;ACUTE&gt;;&lt;UPPER-CASE&gt;;IGNORE
&lt;a-grave&gt;  &lt;a&gt;;&lt;GRAVE&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;A-grave&gt;  &lt;a&gt;;&lt;GRAVE&gt;;&lt;UPPER-CASE&gt;;IGNORE
&lt;ae&gt;      "&lt;a&gt;&lt;e&gt;";"&lt;LIGATURE&gt;&lt;LIGATURE&gt;";\
          "&lt;LOWER-CASE&gt;&lt;LOWER-CASE&gt;";IGNORE
&lt;AE&gt;      "&lt;a&gt;&lt;e&gt;";"&lt;LIGATURE&gt;&lt;LIGATURE&gt;";\
          "&lt;UPPER-CASE&gt;&lt;UPPER-CASE&gt;";IGNORE
&lt;b&gt;        &lt;b&gt;;&lt;NO-ACCENT&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;B&gt;        &lt;b&gt;;&lt;NO-ACCENT&gt;;&lt;UPPER-CASE&gt;;IGNORE
&lt;c&gt;        &lt;c&gt;;&lt;NO-ACCENT&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;C&gt;        &lt;c&gt;;&lt;NO-ACCENT&gt;;&lt;UPPER-CASE&gt;;IGNORE
&lt;ch&gt;       &lt;ch&gt;;&lt;NO-ACCENT&gt;;&lt;LOWER-CASE&gt;;IGNORE
&lt;Ch&gt;       &lt;ch&gt;;&lt;NO-ACCENT&gt;;&lt;PECULIAR&gt;;IGNORE
&lt;CH&gt;       &lt;ch&gt;;&lt;NO-ACCENT&gt;;&lt;UPPER-CASE&gt;;IGNORE
#
# As an example, the strings "Bach" and "bach" could be encoded (for
# compare purposes) as:
# "Bach"  &lt;b&gt;;&lt;a&gt;;&lt;ch&gt;;&lt;LOW_VALUE&gt;;&lt;NO_ACCENT&gt;;&lt;NO_ACCENT&gt;;\
#            &lt;NO_ACCENT&gt;;&lt;LOW_VALUE&gt;;&lt;UPPER&gt;;&lt;LOWER&gt;;&lt;LOWER&gt;;&lt;NULL&gt;
# "bach"  &lt;b&gt;;&lt;a&gt;;&lt;ch&gt;;&lt;LOW_VALUE&gt;;&lt;NO_ACCENT&gt;;&lt;NO_ACCENT&gt;;\
#            &lt;NO_ACCENT&gt;;&lt;LOW_VALUE&gt;;&lt;LOWER&gt;;&lt;LOWER&gt;;&lt;LOWER&gt;;&lt;NULL&gt;
#
# The two strings are equal in pass 1 and 2, but differ in pass 3.
#
# Further characters follow.
#
UNDEFINED    IGNORE;IGNORE;IGNORE;IGNORE
#
order_end
#
END LC_COLLATE
#
LC_MONETARY
int_curr_symbol    "USD "
currency_symbol    "$"
mon_decimal_point  "."
mon_grouping       3;0
positive_sign      ""
negative_sign      "-"
p_cs_precedes      1
n_sign_posn        0
END LC_MONETARY
#
LC_NUMERIC
copy "US_en.ASCII"
END LC_NUMERIC
#
LC_TIME
abday   "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat"
#
day     "Sunday";"Monday";"Tuesday";"Wednesday";\
        "Thursday";"Friday";"Saturday"
#
abmon   "Jan";"Feb";"Mar";"Apr";"May";"Jun";\
         "Jul";"Aug";"Sep";"Oct";"Nov";"Dec"
#
mon     "January";"February";"March";"April";\
        "May";"June";"July";"August";"September";\
        "October";"November";"December"
#
d_t_fmt "%a %b %d %T %Z %Y\n"
END LC_TIME
#
LC_MESSAGES
yesexpr "^([yY][[:alpha:]]*)|(OK)"
#
noexpr  "^[nN][[:alpha:]]*"
END LC_MESSAGES
</code>
</pre>

</blockquote>
<hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
